Hi Farnoosh,

May be this helps:

 within(DataA,Var3 <- (Var1|Var2)+0)


A.K.




On Wednesday, March 5, 2014 6:03 PM, farnoosh sheikhi <farnoosh...@yahoo.com> 
wrote:

Hi Arun,

I have a data like below, I want to collapse var1 and var 2 together.
DataA <- read.table(text="ID,Var1,Var2
1,1,0
2,0,1
                    3,0,0
                    4,0,1
                    5,1,0",sep=",",header=TRUE,stringsAsFactors=FALSE)


var3 should be a new column (1,1,0,1,1)
Thanks tons.

______________________________________________
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.

Reply via email to