Re: [R] two columns into one

2010-06-03 Thread Wu Gong
Try unique and paste. paste(unique(tes)[,1], unique(tes)[,2], sep = "") - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/two-columns-into-one-tp2242516p2242658.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] two columns into one

2010-06-03 Thread Jorge Ivan Velez
Hi there, May be expand.grid() ? HTH, Jorge On Thu, Jun 3, 2010 at 5:55 PM, moleps <> wrote: > Dear R´ers, > > > How can I create one single factor variable from two variables > incorporating all possible combinations of the values?? > > > test<-sample(c("A",NA,"B"),100,replace=T) > test2<-sam

[R] two columns into one

2010-06-03 Thread moleps
Dear R´ers, How can I create one single factor variable from two variables incorporating all possible combinations of the values?? test<-sample(c("A",NA,"B"),100,replace=T) test2<-sample(c("E",F,"A"),100,replace=T) tes<-cbind(test,test2) pseduocode: r<-function(test,test2) r AE AF AA NA