Re: [R] Search for common character strings within a column

2013-04-12 Thread arun
Hi, May be this helps: Not sure how you wanted to select those two letters.  dat1- read.table(text=    Seq,Output  A B B C D A C,Yes  B C A C B D A C,Yes C D A A C D,No ,sep=,,header=TRUE,stringsAsFactors=FALSE) library(stringr) lapply(str_split(str_trim(dat1$Seq),

Re: [R] Search for common character strings within a column

2013-04-12 Thread arun
HI, In case if you wanted to take BC and CB as the same. dat1- read.table(text=    Seq,Output  A B B C D A C,Yes  B C A C B D A C,Yes C D A A C D,No ,sep=,,header=TRUE,stringsAsFactors=FALSE) lapply(str_split(str_trim(dat1$Seq), )[dat1$Output==Yes],function(x) {x1-t(combn(x,2));