Quantcast
Channel: Active questions tagged xts - Stack Overflow
Viewing all articles
Browse latest Browse all 53

Is indexAt="lastof" no longer valid for xts::to.weekly?

$
0
0

simple reproducible example:

set.seed(1234)len <- 1000fake <- zoo::zoo(rnorm(len, mean = 0.001, sd = 0.0005), order.by = seq.Date(from = as.Date("2000-01-01", tz = "UTC"), length.out = len, by = "day"))lastof_monthly <- xts::to.monthly(fake, indexAt = "lastof", OHLC = F, drop.time = T)monthly        <- xts::to.monthly(fake, OHLC = F, drop.time = T) head(monthly)head(lastof_monthly)lastof_weekly <- xts::to.weekly(fake, indexAt = "lastof", OHLC = F, drop.time = T)

yields output for to.monthly but generates an error for to.weekly as of R 4.3:

Error in !missing(sec) && sec%%1 != 0 : 'length = 144' in coercion to 'logical(1)'

output of sessionInfo() for above error:

> sessionInfo()R version 4.4.1 (2024-06-14 ucrt)Platform: x86_64-w64-mingw32/x64Running under: Windows 11 x64 (build 22621)Matrix products: defaultlocale:[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8    LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C                           [5] LC_TIME=English_United Kingdom.utf8    time zone: Europe/Londontzcode source: internalattached base packages:[1] stats     graphics  grDevices utils     datasets  methods   base     loaded via a namespace (and not attached): [1] digest_0.6.35     xts_0.14.0        fastmap_1.1.1     xfun_0.43         lattice_0.22-6    magrittr_2.0.3    zoo_1.8-12        glue_1.7.0        stringr_1.5.1    [10] knitr_1.46        htmltools_0.5.8.1 rmarkdown_2.26    lifecycle_1.0.4   cli_3.6.2         grid_4.4.1        compiler_4.4.1    rstudioapi_0.16.0 tools_4.4.1      [19] evaluate_0.23     yaml_2.3.8        rlang_1.1.3       jsonlite_1.8.8    stringi_1.8.3    

Expected xts::to.weekly to yield a valid result with the argument indexAt="lastof"


Viewing all articles
Browse latest Browse all 53

Trending Articles