On Thu, Mar 9, 2017 at 9:03 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote: > On Thu, Mar 9, 2017 at 3:46 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote: >> On Thu, Mar 9, 2017 at 3:31 PM, Waichler, Scott R >> <scott.waich...@pnnl.gov> wrote: >>> Hi, >>> >>> I found that apply.monthly() in xts does not work as I expected in the case >>> of a sparse timeseries: >>> >>> my.dates <- as.Date(c("1992-06-01", "1992-06-24", "1992-06-30", >>> "1993-06-22", "1994-06-07", "1995-06-08")) >>> my.xts <- xts(1:6, my.dates) >>> start(my.xts) # "1992-06-24" >>> end(my.xts) # "1995-06-08" >>> apply.monthly(my.xts, mean) >>> # [,1] >>> # 1995-06-08 3.5 >>> >>> The endpoints it chooses are based on looking at the month (June) alone. I >>> was able to get a value for each (month, year) in the timeseries with the >>> following use of aggregate(): >>> >> Thanks for the minimal, reproducible example! This is clearly a bug. >> > Now formally documented as such: > https://github.com/joshuaulrich/xts/issues/169 > And now fixed. Will be in the next release.
Thanks again for the report! <snip> -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com R/Finance 2017 | www.rinfinance.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.