Coerce xts to ts in R

后端 未结 5 1885
Happy的楠姐
Happy的楠姐 2021-01-07 02:54

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

5条回答
  •  情深已故
    2021-01-07 03:46

    I recently have discovered a package called "tsbox".

    It promises easy conversion between time series types. (here a tutorial: https://cran.r-project.org/web/packages/tsbox/vignettes/tsbox.html)

    Might be useful in cases like this one.

    Here an example:

    library(tsbox)
    nowTS <-ts_ts(formerXTS)
    

    or the other way round if you want to convert the ts back to an xts series

    library(tsbox)
    nowXTS <-ts_xts(nowTS)
    

提交回复
热议问题