kevinushey/RcppRoll

argument n should be NULL by default...

Mullefa opened this issue · 2 comments

...or something similar.

# the outputs of these functions calls are identical (n doesn't alter the result)
roll_meanr(1:10, n = 0, c(0, 1))
roll_meanr(1:10, n = 2, c(0, 1))
roll_meanr(1:10, n = 100, c(0, 1))

# however, you have to give it an arbitrary value as the following throws an error
roll_meanr(1:10, weights = c(0, 1))

I've set the default value of n to be 1L; note that it will be ignored when the weights parameter is set. This should resolve this issue but let me know if you encounter anything else!

Will do. Cheers.