Inconsistent Handling of NAs using roll_median()
csatzky opened this issue · 2 comments
csatzky commented
Hi there,
Thank you for developing this extremely useful package.
When using roll_median()
in the presence of NA values the output is inconsistent with all other functions, e.g. roll_mean()
, roll_sum()
, etc.
According to the documentation, all of the parameters are the same by default across roll_...()
functions.
# a vector with NAs
vec <- c(1:5, rep(NA,3), 6:10, NA)
# expected output of computed & NA values
roll_mean(vec, 5)
roll_var(vec, 5)
# output using roll_median()
roll_median(vec, 5)
Also for this function, there is no difference whether na.rm = c(TRUE, FALSE)
.
Thank you.
Cheers,
Christian
kevinushey commented
Thanks for the bug report! I believe this should now be resolved in the development version of RcppRoll
. You can give it a spin with:
remotes::install_github("kevinushey/RcppRoll")
csatzky commented
It seems to work well now! Thank you very much for the fix!
Cheers,
C