You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrong description of the period.apply function returned value in the xts package user's manual
Expected behavior
It is said that one should get "A vector with length of INDEX minus 1",
Observed behavior
I get an output of length = length(INDEX) + as.numeric(tail(INDEX,1) < length(x)) (admitting x is a vector). More precisely, I observed that the returned vector is:
Your example, period.apply(1:10, seq(start, 10, by = icr), mean), will provide unusual results whenever start != 0. This is because period.apply() expects INDEX to be similar to the output of endpoints(), which always returns a vector that has zero as the first value and nrow(x) as the last value.
Thanks for the report! I will amend the documentation.
Description
Wrong description of the period.apply function returned value in the xts package user's manual
Expected behavior
It is said that one should get "A vector with length of INDEX minus 1",
Observed behavior
I get an output of
length = length(INDEX) + as.numeric(tail(INDEX,1) < length(x))
(admittingx
is a vector). More precisely, I observed that the returned vector is:[ FUN(x[1:INDEX[1]]), ..., FUN(x[(INDEX[k]+1):INDEX[k+1]]), ...]
adding
FUN(x[(tail(INDEX,1)+1):length(x)])
at the end iftail(INDEX,1) < length(x)
.Minimal, reproducible example
Try to modify
start
andicr
in the following:Session Info
The text was updated successfully, but these errors were encountered: