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 --
>
>
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,
2 matches
Mail list logo