Hi,

Try ifelse function.

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

Cheers

Philippe Baril Lecavalier
On 2011-11-10 8:03 AM, "David ." <loove...@hotmail.com> wrote:

>
> Dear R-project!
>
> How do i create 1 dummy from 2 already existing dummys. To be more
> precise, I want to create a dummy from a dummy called "sex" and another
> called "sex1" when both thoose dummys are 1 I want my created dummy
> "samesex" to take 1.
>
> Thanks for the help!
>
> Paulie
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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