[R] recoding variables

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Thu Mar 11 16:18:27 CET 2004



Shayna Strom wrote:

> Hi,
> 
> I was hoping someone could help me.  I am a graduate student new to using R, and I'm trying to figure out how to recode a continuous variable to make it into an ordinal variable with 3 categories.  I literally have no idea how to proceed--could anyone possibly advise me?  Please copy me on any responses, as I have just subscribed to the R-help email list but don't know whether the subscription has gone through yet.
> 
> Thanks so much-
> Shayna
> 
> ______________________________________________
> R-help at 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

Sorry sent too quickly. Probably what you want is ?cut too.

x <- runif(30)
xcut <- cut(x, c(0, 1/3, 2/3, 1))
xord <- ordered(xcut)




More information about the R-help mailing list