I have xts time-series object for 10 days of data. The data is sampled at minutes frequency. Therefore, for each day, I have 1440 observations. I need to coerce
xts
i think what you are looking for is the below:
xts2ts <- function(XD) { maxRow <- nrow(XD) startYM <- c(.indexyear(XD[1]) + 1900, .indexmon(XD[1]) + 1L) endYM <- c(.indexyear(XD[maxRow]) + 1900, .indexmon(XD[maxRow]) + 1L) ts(as.numeric(XD), start = startYM, end = endYM, frequency = 12L) }