Skip to content
Prev 276936 / 398506 Next

Creating dummys in R

Without having any actual idea what you mean (sample data!), this might work:

sex <- c(1,0,1,0)
sex1 <- c(1,1,0,0)
samesex <- ifelse(sex == 1 & sex1 == 1, 1, 0)

Note that this does NOT return 1 if both initial variables are 0, so
it isn't really a samesex indicator, but it is my best guess as to
what you might want.

Sarah
On Thu, Nov 10, 2011 at 5:13 AM, David . <loovet88 at hotmail.com> wrote: