[R] Collapsing columns to one
arun
smartpink111 at yahoo.com
Thu Mar 6 03:01:24 CET 2014
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_81 at 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.
More information about the R-help
mailing list