View source: R/split_columns.R
split_columns | R Documentation |
Based on stringi::stri_split_fixed()
column names are split on basis of a split pattern into new columns.
The content of the original column is duplicated in all split columns.
split_columns(x, pattern)
x |
A |
pattern |
The pattern to split the columns (will not be included in the new column names). |
Dependding on the input class, a data.frame
or data.table
with the additional columns.
df <- data.frame(split_here = 11:13, and_here = letters[11:13], and_again_here = 14:16) split_columns(df, "_") # split here and here and again here # 1 11 11 k k 14 14 14 # 2 12 12 l l 15 15 15 # 3 13 13 m m 16 16 16
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.