0

For example if I create the following xts object: index <- seq(from = Sys.Date(), by = "day", length.out = 100) xts_object <- xts(rnorm(100), order.by = index)

I can split into one-month period with the "split" function: list_object <- split(xts_object, f = "months")

And I can find the endpoints in my index that correspond to the last by-monthly points with "endpoints": endpoints <- endpoints(xts_object, on = "months", k = 2)

But I how can I split my time series based on those endpoints?

Your help is greatly appreciated!

M--
  • 25,431
  • 8
  • 61
  • 93
dougie
  • 1
  • 1

1 Answers1

0

Ok, I just figured it out. Split also has k argument, so it's straightforward:

list_object <- split(xts_object, f = "months", k = 2)
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
dougie
  • 1
  • 1