Skip to content

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

Description

@DavisVaughan

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)

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions