Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of na.rm = T in roll_median #26

Open
joranE opened this issue May 25, 2017 · 0 comments
Open

Behavior of na.rm = T in roll_median #26

joranE opened this issue May 25, 2017 · 0 comments

Comments

@joranE
Copy link

joranE commented May 25, 2017

I'm confused by what na.rm = TRUE is supposed to do in roll_median:

library(RcppRoll)
x <- 1:20
x[3:4] <- NA
x

roll_medianr(x = x,n = 5,na.rm = TRUE)
[1] NA NA NA NA  2  2 NA NA  7  8  9 10 11 12 13 14 15 16 17 18
roll_maxr(x = x,n = 5,na.rm = TRUE)
[1] NA NA NA NA  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

Why is the median in position 6 equal to 2 rather than 3.5? Why are there NAs positions 7 and 8?

Am I missing something obvious or is this a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant