[R] Cumulative split of value in data frame column
r@v|76 @end|ng |rom gm@||@com
Fri Jun 5 18:32:36 CEST 2020
Assuming, I have a data frame like this ..
df <- data.frame(ID=1:3, FOO=c('A_B','A_B_C','A_B_C_D_E'))
I want to do a 'cumulative split' of the values in column FOO based on the
delimiter '_'. The end result should be like this ..
ID FOO FOO_SPLIT1 FOO_SPLIT2 FOO_SPLIT3
1 A_B A A_B
2 A_B_C A A_B
3 A_B_C_D_E A A_B A_B_C
Any efficient, optimized way to do this?
This email has been checked for viruses by AVG.
[[alternative HTML version deleted]]
More information about the R-help