Re: [R] Using cbind to merge different variables

2013-12-22 Thread PIKAL Petr
Hi Another option is dat1$Newvar <- 1*(rowSums(dat1)>0) Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of arun > Sent: Friday, December 20, 2013 4:59 PM > To: R help > Subject: Re:

Re: [R] Using cbind to merge different variables

2013-12-20 Thread arun
HI, May be this helps: set.seed(45)  dat1 <- as.data.frame(matrix(sample(0:1,100*5,replace=TRUE),ncol=5)) dat1$Newvar <- 1*(!!rowSums(dat1)) A.K. Hello. I have a problem combining a number of variables. I have five columns with binary variables with the values 0 and 1. I would like to comb