powered by
Separates a single column into multiple columns
separate_wider_delim( .df, cols, delim, ..., names = NULL, names_sep = NULL, names_repair = "check_unique", too_few = c("align_start", "error"), too_many = c("drop", "error"), cols_remove = TRUE )
A data frame
Columns to separate
Delimiter to separate on
These dots are for future extensions and must be empty.
New column names to separate into
Names separator
Treatment of duplicate names. See ?vctrs::vec_as_names for options/details.
?vctrs::vec_as_names
What to do when too few column names are supplied
What to do when too many column names are supplied
Should old columns be removed
df <- tidytable(x = c("a", "a_b", "a_b", NA)) df %>% separate_wider_delim(x, delim = "_", names = c("left", "right")) df %>% separate_wider_delim(x, delim = "_", names_sep = "")
Run the code above in your browser using DataLab