r-lib / slider

Sliding Window Functions

Home Page:https://slider.r-lib.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I made a mistype. But it was a strange behavior, so I will report it.

amazongodman opened this issue · comments

this code , mutate all row 10.
I was miss type before insted befor.

tibble(x=rbinom(100000, size=1, prob=0.001)) %>% 
  mutate(rn = row_number()) %>% 
  mutate(m_sum = slide_dbl(x,sum,.befor = 10))

No error was shown.

I was struggling for a while to solve the problem, so I'll leave a note in the hope that slider will improve its functionality.

Calculating moving averages is now much easier.
Thanks slider.
Thank you developer.

There isn't a lot I can do here, unfortunately. The ... that come after .f are used to supply additional arguments to .f. In your case .befor = 10 was passed on to sum() along with .x, which isn't an error. All of your sum() values just increased by 10.

library(slider)

slide_dbl(1:5, sum, hi_there = 10)
#> [1] 11 12 13 14 15

There is nothing I can do about the partial match typo!

@DavisVaughan

thanks your reply.
I need to bug fix the English vocabulary in my head.
I'm glad if this mistake helps someone else.