You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should indices_to go to left of value column? #1486
This seems like a good tidy dev day issue, I think you'd need to look at new_long_indexed_frame() in particular, and make sure tests get updated to account for the new order, and add a NEWS bullet.
Here are some examples of what we mean by this:
library(tidyr)
df<- tibble(
x=1:4,
y=list(NULL, 1:3, 4:5, integer())
)
# i.e. should `index` come before `y`?df|> unnest_longer(y, indices_to="index")
#> # A tibble: 5 × 3#> x y index#> <int> <int> <int>#> 1 2 1 1#> 2 2 2 2#> 3 2 3 3#> 4 3 4 1#> 5 3 5 2# more examplesdf<- tibble(
x=1:2,
y=list(1:2, 3:4),
z=list(5:6, 7:8)
)
df|>
unnest_longer(c(y, z), indices_to="{col}_id")
#> # A tibble: 4 × 5#> x y y_id z z_id#> <int> <int> <int> <int> <int>#> 1 1 1 1 5 1#> 2 1 2 2 6 2#> 3 2 3 1 7 1#> 4 2 4 2 8 2df<- tibble(
x=1:2,
y=list(c(a=1, b=2), c(a=10, b=11, c=12))
)
df|> unnest_longer(y, indices_to="foo")
#> # A tibble: 5 × 3#> x y foo #> <int> <dbl> <chr>#> 1 1 1 a #> 2 1 2 b #> 3 2 10 a #> 4 2 11 b #> 5 2 12 c
Activity
DavisVaughan commentedon Feb 16, 2023
Seems reasonable to me
DavisVaughan commentedon Sep 8, 2025
This seems like a good tidy dev day issue, I think you'd need to look at
new_long_indexed_frame()in particular, and make sure tests get updated to account for the new order, and add a NEWS bullet.Here are some examples of what we mean by this:
Updating unnest_longer() and tests to output indices before values. F…
Updates unnest_longer() and tests such that indices are output before…
Place `indices_to` columns before values columns in `unnest_longer()` (…