Here is an example dataframe:
df <- data.frame(col1 = c('x: 1', 'y: 2'))
I would like to split 'col1' by the colon and store each token in a separate column. The following is how the output should look like:
col1 , col2
x , 1
y , 2
the line below is doing the split but how to store each token in it's own column:
df %>% mutate(x = str_split(col1,': ',2))