I have an intraday series (in xts) that I would like to aggregate into daily frequency: apply.daily(mean(asd))
. It gives me:
Error in try.xts(x, error = "must be either xts-coercible or timeBased") : must be either xts-coercible or timeBased
Does anybody know where this error might come from?
> 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"
The syntax would be
For more info, check the
?apply.daily
and the examples in that page.I can reproduce the error with the wrong code syntax