On Nov 3, 2014, at 10:47 AM, Bert Gunter wrote: > See ?strsplit using the fixed =";" argument on the column containing > the character vector you wish to split. > > The trickier part is that the result is a list that needs to be > manipulated -- ?do.call might be useful here, although I haven't > thought about it seriously -- to build your data frame containing > missings. There are various ways to do this, but "An Introduction to > R" (ships with R) -- you have read it right? -- should provide the > info you need. > > That should get you started. Others may provide a more complete > solution, but that's much less fun.
Here's a start using the fill argument to read.table and the 'Members' column as text data: cbind(dat, read.table(text=as.character(dat$Members), sep=";", fill =TRUE)[-1] ) #---------------------- ID Members V2 V3 V4 1 1 ; abc; def; ghi abc def ghi 2 2 ; abc; abc 3 3 ;def; def > > Cheers, > Bert > > Bert Gunter > Genentech Nonclinical Biostatistics > (650) 467-7374 > > "Data is not information. Information is not knowledge. And knowledge > is certainly not wisdom." > Clifford Stoll > > > > > On Mon, Nov 3, 2014 at 8:05 AM, Matthias Weber > <matthias.we...@fntsoftware.com> wrote: >> >> Hello togehter, >> >> i have a little problem, maybe anyone can help me. >> >> I have a data.frame, which look like this one: >> ID Members >> 1 1 ; abc; def; ghi >> 2 2 ; abc; >> 3 3 ;def; >> >> How can I create another column for each value between 2 semicolons? >> >> The result look like this one: >> >> ID Members Member1 Member2 >> Member3 >> 1 1 ; abc; def; ghi abc def >> ghi >> 2 2 ; abc; abc >> 3 3 ;def; def >> >> Maybe anyone can help me. Thank you. >> >> Best regards. >> >> Mat >> >> > > ______________________________________________ > R-help@r-project.org mailing list > 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. David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list 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.