Is there a way to mutate a column that has been previously packed?
df <- tibble::tibble(x1 = 1:3, x2 = 4:6, x3 = 7:9, y = 1:3) |>
tidyr::pack(x = tidyselect::starts_with("x"))
For example, I'd like to modify x$x1
while preserving the overal structure of df
. Something like this which obviously doesn't work:
dplyr::mutate(df, x$x1 = letters[1:3])