Hi, Try this: dat1 <- readLines(textConnection("Granitic Hills 16-20 PZ Loamy Upland 16-20 PZ Sandy Loam Upland 12-16 PZ / Sandy Loam, Deep 12-16 PZ Loamy Upland 12-16 PZ / Sandy Loam Upland 12-16 PZ Loamy Upland 16-20 PZ"))
dat3<-strsplit(dat1,"/") data.frame(col1=do.call(rbind,lapply(dat3,`[`,1)),col2=do.call(rbind,lapply(dat3,`[`,2))) # col1 col2 #1 Granitic Hills 16-20 PZ <NA> #2 Loamy Upland 16-20 PZ <NA> #3 Sandy Loam Upland 12-16 PZ Sandy Loam, Deep 12-16 PZ #4 Loamy Upland 12-16 PZ Sandy Loam Upland 12-16 PZ #5 Loamy Upland 16-20 PZ <NA> A.K. ----- Original Message ----- From: Sapana Lohani <lohani.sap...@ymail.com> To: "r-help@r-project.org" <r-help@r-project.org> Cc: Sent: Tuesday, August 21, 2012 1:54 AM Subject: [R] irregular splits in dataframe Hello everyone, My dataframe (Soil Type) looks something like this Granitic Hills 16-20 PZ Loamy Upland 16-20 PZ Sandy Loam Upland 12-16 PZ / Sandy Loam, Deep 12-16 PZ Loamy Upland 12-16 PZ / Sandy Loam Upland 12-16 PZ Loamy Upland 16-20 PZ I want to separate them at "/", but when there is just one type, I want "NA" in the second column, How can I do that ?? Thank you [[alternative HTML version deleted]] ______________________________________________ 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. ______________________________________________ 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.