Re: [R] Building a binary vector out of dichotomous variables

2016-06-16 Thread Tom Wright
Does this do what you want? as.numeric(with(ds_example,paste(1,year2013,year2014,year2015,sep=''))) On Thu, Jun 16, 2016 at 8:57 AM, wrote: > Hi All, > > I need to build a binary vector made of a set of dichotomous variables. > > What I have so far is: > > -- cut -- > >

[R] Building a binary vector out of dichotomous variables

2016-06-16 Thread G . Maubach
Hi All, I need to build a binary vector made of a set of dichotomous variables. What I have so far is: -- cut -- ds_example <- structure( list( year2013 = c(0, 0, 0, 1, 1, 1, 1, 0), year2014 = c(0, 0, 1, 1, 0, 0, 1, 1), year2015 = c(0, 1, 1, 1, 0, 1,