R: [R] Creating Binary Outcomes from a continuous variable

From: Guazzetti Stefano <Stefano.Guazzetti_at_ausl.re.it>
Date: Wed 07 Jul 2004 - 23:05:15 EST


consider a cutpoint of 20

x<-runif(100, min=1, max=50)
as.integer(x > 20)

Stefano

> -----Messaggio originale-----
> Da: Doran, Harold [mailto:HDoran@air.org]
> Inviato: mercoledý 7 luglio 2004 14.57
> A: r-help@stat.math.ethz.ch
> Oggetto: [R] Creating Binary Outcomes from a continuous variable
>
>
> Dear List:
>
>
>
> I have searched the archives and my R books and cannot find a
> method to
> transform a continuous variable into a binary variable. For example, I
> have test score data along a continuous scale. I want to create a new
> variable in my dataset that is 1=above a cutpoint (or passed the test)
> and 0=otherwise.
>
>
>
> My instinct tells me that this will require a combination of the
> transform command along with a conditional selection. Any help is much
> appreciated.
>
>
>
> Thanks,
>
> Harold
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 07 23:09:27 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:45 EST