convert string to column name in dplyr

PHOTO EMBED

Fri Jul 28 2023 12:46:48 GMT+0000 (Coordinated Universal Time)

Saved by @vs #r

col_name <- "col"
df %>% dplyr::mutate(new_col = !!dplyr::sym(col_name))
content_copyCOPY