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

with_order() doesn't work with data frame order_by #6334

Closed
DavisVaughan opened this issue Jul 15, 2022 · 0 comments · Fixed by #6335
Closed

with_order() doesn't work with data frame order_by #6334

DavisVaughan opened this issue Jul 15, 2022 · 0 comments · Fixed by #6335
Assignees
Labels
bug an unexpected problem or unintended behavior

Comments

@DavisVaughan
Copy link
Member

An edge case, but an easy fix. Replace seq_along() with vec_seq_along() in with_order()

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

df <- tibble(a = c(1, 1, 2), b = c(2, 1, 1))

# Should be `c(2, NA, 1)`
with_order(order_by = df, fun = lag, x = 1:3)
#> [1]  2 NA

Created on 2022-07-15 by the reprex package (v2.0.1)

@DavisVaughan DavisVaughan self-assigned this Jul 15, 2022
@DavisVaughan DavisVaughan added the bug an unexpected problem or unintended behavior label Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant