Re: [R] making an inicator variable

From: Wensui Liu <liuwensui_at_gmail.com>
Date: Wed 26 Oct 2005 - 07:03:33 EST

x<-c(1, 2);
y<-ifelse(x==1, 1, 0);

On 10/25/05, Jennifer Dillon <jdillon@hsph.harvard.edu> wrote:
>
> Hello,
>
> I am almost a total novice, and I am sure there must be an easy (and
> basic) way to turn a variable of 1's and 2's into a variable of zeros
> and ones. This is in a data frame, but if I could do it with vectors,
> that's all I need.
>
> Can someone tell me how?
>
> Thanks so much,
>
> Jen
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

--
WenSui Liu
(http://statcompute.blogspot.com)
Senior Decision Support Analyst
Cincinnati Children Hospital Medical Center

	[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Oct 26 07:17:46 2005

This archive was generated by hypermail 2.1.8 : Wed 26 Oct 2005 - 09:15:22 EST