[R] Ordering in factors ...

Chuck Cleland ccleland at optonline.net
Fri Jun 28 12:46:28 CEST 2002


j.logsdon at lancaster.ac.uk wrote:
> In MASS(2) P26 for S-Plus you can write:
> 
> ordered(income)<-c("Lo","Mid","Hi")
> 
> but in R 1.5.0 you get the response to such an instruction:
> 
> Error: couldn't find function "ordered<-"

Try this:

income <- ordered(income, levels=c("Lo", "Mid", "Hi"))

Chuck Cleland
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list