我正在使用zoo和xts包来分析财务数据。ts包不太适合,因为金融系列有周末,没有可用的数据。
我在xts包中读到了可用的应用函数
apply.daily(x, FUN, ...)
apply.weekly(x, FUN, ...)
apply.monthly(x, FUN, ...)
apply.quarterly(x, FUN, ...)
apply.yearly(x, FUN, ...)此应用函数跨日历周期,并认为这样的东西将工作,以获得一周的结束值,但它似乎不工作。
apply.weekly(x,尾部)
发布于 2013-05-07 00:26:20
apply.weekly(x, tail)不起作用,因为tail默认返回最后6个观察值。请改用apply.weekly(x, tail, 1)。
https://stackoverflow.com/questions/16402915
复制相似问题