I have an xts object which represents a variable measured over a two week time period using 15 minute sampling.
An example of the data is as follows:
> class(wideRawXTS)
[1] "xts" "zoo"
> head(wideRawXTS[,2],10)
DO0182U09B3
2017-01-20 16:30:00 -103.37
2017-01-20 16:45:00 -102.75
2017-01-20 17:00:00 -103.30
2017-01-20 17:15:00 -95.92
2017-01-20 17:30:00 -103.04
2017-01-20 17:45:00 -103.67
2017-01-20 18:00:00 -103.26
2017-01-20 18:15:00 -103.86
2017-01-20 18:30:00 -103.96
2017-01-20 18:45:00 -103.33
> str(wideRawXTS)
An ‘xts’ object on 2017-01-20 16:30:00/2017-02-03 16:00:00 containing:
Data: num [1:1343, 1:12] -102 -101 -101 -101 -101 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:12] "DO0182U09A3" "DO0182U09B3" "DO0182U09C3" "DO0182U21A1" ...
Indexed by objects of class: [POSIXlt,POSIXt] TZ:
xts Attributes:
NULL
I wish to extract each day i.e. 24 hrs of data - 2017-01-20 16:30:00 -> 2017-01-21 16:30:00 for a single variable so that I can calculate the intra day correlation for this single variable.
I've checked out Joshua Ulrich's XTS FAQ but it doesn't address data which has a date and time component.
How can I subset this XTS object into 14 day blocks (96 samples)?