This is a trivial question probably buried in page 21 somewhere of An Idiot's Guide to R. 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<-" What's the fix to this? I have a series of models where the factors as reported need re-ordering so that the glm reports the coefficients with respect to the correct level. At the moment, while the solutions are identical, I actually have to do some arithmetic to show this. TIA John -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 28 Jun 2002 j.logsdon at lancaster.ac.uk wrote:> This is a trivial question probably buried in page 21 somewhere of An > Idiot's Guide to R. > > 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<-" > > What's the fix to this? I have a series of models where the factors as > reported need re-ordering so that the glm reports the coefficients with > respect to the correct level. At the moment, while the solutions are > identical, I actually have to do some arithmetic to show this.There are scripts for MASS3 in the VR bundle, which give income <- ordered(c("Mid","Hi","Lo","Mid","Lo","Hi","Lo")) income as.numeric(income) inc <- ordered(c("Mid","Hi","Lo","Mid","Lo","Hi","Lo"), levels = c("Lo", "Mid", "Hi")) inc ordered factors in R are not quite the same as those in S. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._