I'd like to extract values from a
tbl_df object using a character string with a custom class but I'm getting the following error:
bar <- structure("x", class = c("foo", "character")) tbl <- tibble::tibble(x = 1:3, y = letters[1:3]) tbl[[bar]] #> Error in `tbl[[bar]]`: #> ! Can't extract column with `bar`. #> ✖ `bar` must be numeric or character, not a <foo/character> object.
Is there a work around for this that doesn't consist in removing the
tbl_df/tbl classes of the tibble or rewriting accessor methods?