我不确定为什么我的功能isBizday不起作用。我得到的错误是:
isBizday错误(日期,holidayTSX()): 试图获得插槽"数据"来自一个不是S4对象的对象(类" Date")
我的代码:
Dates[isBizday(Dates, holidayTSX())]
我应该如何纠正此错误?
我的数据示例:
Dates<-structure(c(15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340,
15340, 15340, 15340, 15340, 15340, 15340, 15340, 15340, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341, 15341,
15341, 15341, 15341, 15341, 15341, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342, 15342,
15342, 15342), class = "Date")
答案 0 :(得分:1)
您可能正在讨论isBizday
包中的函数timeDate
。首先,您应该阅读此函数[here]的文档。
写道:
x是类timeDate的对象。
所以你需要转换日期:
d <- as.timeDate(Dates)
isBizday(d)