我有一个日内系列( xts),我想聚合成每日频率:apply.daily(mean(asd))。它给了我:
Try.xts中的错误(x,Error =“必须是xts-矫顽力或timeBased"):必须是xts-矫顽力或timeBased
有人知道这个错误可能来自哪里吗?
> head(asd)
EUR.USD.Close
2015-01-02 01:00:00 1.20875
2015-01-02 01:01:00 1.20870
2015-01-02 01:02:00 1.20880
2015-01-02 01:03:00 1.20890
2015-01-02 01:04:00 1.20885
2015-01-02 01:05:00 1.20885
> str(asd)
An ‘xts’ object on 2015-01-02 01:00:00/2015-01-30 22:59:00 containing:
Data: num [1:28140, 1] 1.21 1.21 1.21 1.21 1.21 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "EUR.USD.Close"
Indexed by objects of class: [POSIXct,POSIXt] TZ:
xts Attributes:
List of 4
$ from : chr "20150421 09:00:00"
$ to : chr "20150501 09:00:00"
$ src : chr "IB"
$ updated: POSIXct[1:1], format: "2015-06-07 01:46:37"发布于 2015-06-11 21:21:40
语法应该是
apply.daily(asd, mean)
# EUR.USD.Close
#2015-01-02 01:05:00 1.208808有关更多信息,请查看?apply.daily和该页面中的示例。
我可以用错误的代码语法再现错误。
apply.daily(mean(asd))
#Error in try.xts(x, error = "must be either xts-coercible or timeBased") :
# must be either xts-coercible or timeBasedhttps://stackoverflow.com/questions/30791644
复制相似问题