Skip to content

pivot_wider: rethrow_id_cols_oob() - new error #1616

@gevro

Description

@gevro

Hi, I found this error for a different situation than #1609 that I'm not sure are addressed by the fixes for that issue.

df <- tibble(col1 = c("x", "y"), col2 = c(1, 2), col3 = c("a", "b"), col4 = c("c", "d"))

df %>% pivot_wider(id_cols = all_of(c("col1","col2")), names_from = col3, values_from = -all_of(c("col1", "col4")))

Error:

Error in `rethrow_id_cols_oob()`:
! `i` must be a single string, not a character vector.
ℹ This is an internal error that was detected in the tidyr package.
  Please report it at <https://github.com/tidyverse/tidyr/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace.
Run `rlang::last_trace()` to see where the error occurred.

No error:

df %>% pivot_wider(id_cols = all_of(c("col1","col2")), names_from = col3, values_from = -all_of(c("col1", "col2", "col4")))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions