powered by
Given either a regular expression or a vector of character positions, separate_col() turns a single character column into multiple columns.
separate_col()
separate_col(.data, col, into, sep = "[^[:alnum:]]+")
A mutated .data
.data
A data frame
Column name
Names of new variables to create as character vector
The separator between columns. By default, a regular expression that matches any sequence of non-alphanumeric values.
library(pliman) df <- data.frame(x = paste0("TRAT_", 1:5), y = 1:5) df separate_col(df, x, into = c("TRAT", "REP"))
Run the code above in your browser using DataLab