col_split | R Documentation |
Split A Vector into Columns
col_split(x, split, reg_expr, colnames, cat = TRUE)
x |
a vector |
split |
one or more characters. Split exactly |
reg_expr |
character. Split by regular expressions |
colnames |
optional. Column names for outcome |
cat |
logical, whether to show message |
A dataframe with several columns.
x=c('1a2','3a4','4a4')
col_split(x,split='a')
col_split(x = x,reg_expr = '[a-z]')
#two splits
df=data.frame(result=c('A, B-C',
'A, C-D',
'E, F-G'))
col_split(x = df[,1],split = c(',','-'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.