Skip to content

Referencing column with [[ ]] fails when column name is created from glue  #778

@dturkenk

Description

@dturkenk

Newly upgraded to tibble 3.0.1 and referencing a column using [[ ]] no longer seems to work if the column name is created using glue::glue.

Casting the return as a character seems to work ok.

library(tibble)
#> Warning: package 'tibble' was built under R version 3.6.3
df <- tribble(~a, ~b, "foo", 3)
lbl <- "c"
df[[glue::glue("{lbl}")]] <- "bar"
#> Error: Can't assign to columns that don't exist.
#> x Column `c` doesn't exist.
df[[as.character(glue::glue("{lbl}"))]] <- "bar"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorsubsetting 🍽

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions