separate_col | R Documentation |
Given either a regular expression or a vector of character positions,
separate_col()
turns a single character column into multiple columns.
separate_col(.data, col, into, sep = "[^[:alnum:]]+")
.data |
A data frame |
col |
Column name |
into |
Names of new variables to create as character vector |
sep |
The separator between columns. By default, a regular expression that matches any sequence of non-alphanumeric values. |
A mutated .data
library(pliman)
df <- data.frame(x = paste0("TRAT_", 1:5),
y = 1:5)
df
separate_col(df, x, into = c("TRAT", "REP"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.