-
Notifications
You must be signed in to change notification settings - Fork 418
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
new version breaks pivot_wider #1318
Comments
We are going to need more information to be able to help you. Please provide a reprex. |
I'll try to provide a reprex. In the meantime, were there any breaking changes with the new version of tidyr? |
Here's a reprex: require(devtools) This works:
restart R
This gives an error
|
I had this same error. Basically, I had used a column name in both |
Okay yea this was on purpose. Previously, when you duplicate a column name in both So now library(tidyr)
df <- tibble(
names = c("x", "y"),
value = c(1, 2)
)
df
#> # A tibble: 2 × 2
#> names value
#> <chr> <dbl>
#> 1 x 1
#> 2 y 2
# before
pivot_wider(
df,
id_cols = names, # <- this ends up getting ignored silently
values_from = value,
names_from = names # <- this gets used
)
#> # A tibble: 1 × 2
#> x y
#> <dbl> <dbl>
#> 1 1 2
# after
pivot_wider(
df,
id_cols = names,
values_from = value,
names_from = names
)
#> Error in `chr_as_locations()`:
#> ! Can't subset columns that don't exist.
#> x Column `names` doesn't exist. I'll add an extra note to |
Latest version of tidyr returns error about not being able to subset names that don't exist.
Reverting to ver. 1.1.4 makes the code work again.
I've no time to create a reprex, but here's essentially what breaks:
The text was updated successfully, but these errors were encountered: