Skip to content
Prev 256922 / 398506 Next

Creating a dataframe from a vector of character strings

On 4/14/2011 2:04 PM, Cliff Clive wrote:
Another approach, in addition to the ones you have already been given, 
is to use the colsplit function in the reshape package.  This is the 
sort of thing it is designed to do.

library("reshape")
colsplit(beatles, " ", names=c("firstName", "lastName"))

Similar caveats apply, though, in that it assumes only 2 names that are 
separated by one space (and will give a warning if that is not the case).