Hi, You could use ?strsplit() dat <- read.table(text="'Column 1' 'AAA--> BBB' 'CCC--> DDD'",sep="",header=TRUE,check.names=FALSE,stringsAsFactors=FALSE) dat1 <- setNames(as.data.frame(do.call(rbind,strsplit(dat[,1],"--> ")),stringsAsFactors=FALSE),paste("Column", 1:2)) dat1 # Column 1 Column 2 #1 AAA BBB #2 CCC DDD
#or dat2 <- setNames(read.table(text=gsub("[^[:alnum:]]+"," ",dat[,1]),sep="",header=FALSE,stringsAsFactors=FALSE),paste("Column", 1:2)) identical(dat1,dat2) #[1] TRUE A.K. Hi All, I am using Association Algorithm in RStudio. I am facing a situation, where I need to Split the Single column value into Two column values. Eg: Column 1 Column 1 Column 2 AAA--> BBB AAA BBB CCC--> DDD into CCC DDD Can anyone help me in this ? Thanks, Praveen ______________________________________________ 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.