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 FOO_SPLIT4 FOO_SPLIT5 1 A_B A A_B 2 A_B_C A A_B A_B_C 3 A_B_C_D_E A A_B A_B_C A_B_C_D A_B_C_D_E Any efficient, optimized way to do this? -- This email has been checked for viruses by AVG. https://www.avg.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.