0

I am trying to convert my daily series to weekly frequency by using xts package. However, I couldn't figure out how to dictate the first week of my series is Sunday. Documentation on function doesn't refer any arguments which can be used for this operation.

my_xts <- xts(mydf[, -1], order.by = mydf$Date, tzone = Sys.getenv("TZ"))
my_xts_weekly <- period.apply(my_xts, endpoints(my_xts, on = "weeks"), colSums)
nrow(my_xts_weekly)
omzeybek
  • 305
  • 2
  • 14
  • 1
    no experience with `xts`package, but with `lubridate::wday` you can specify the week.start – Wimpel Sep 22 '18 at 05:30
  • 3
    Possible duplicate of [xts split by week function specify first day of week as Sunday instead of default of Monday](https://stackoverflow.com/questions/49603445/xts-split-by-week-function-specify-first-day-of-week-as-sunday-instead-of-defaul). You need the answer with the most upvotes, not the accepted one. – phiver Sep 22 '18 at 07:10

0 Answers0