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

lag/lead argument handling #683

Closed
romainfrancois opened this issue Oct 11, 2014 · 0 comments
Closed

lag/lead argument handling #683

romainfrancois opened this issue Oct 11, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Oct 11, 2014

From #681:

df <- data.frame(year = 2000:2005, value = (0:5) ^ 2)
scrambled <- df[sample(nrow(df)), ]

wrong <- mutate(scrambled, prev = lag(value))
arrange(wrong, year)

right <- mutate(scrambled, prev = lag(value, order_by = year))

gives :

> right <- mutate(scrambled, prev = lag(value, order_by = year))
Error: could not convert second argument to an integer. type=SYMSXP, length = 1

This is because the second arg here is order_by when the code assumed it is n

@romainfrancois romainfrancois self-assigned this Oct 11, 2014
@romainfrancois romainfrancois added this to the 0.3.1 milestone Oct 11, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant