gautier@lion-ag.de
1999-Sep-02 15:40 UTC
trouble with the 'exclude' parameter of factor() (PR#265)
Full_Name: Laurent Gautier Version: 0.65.0 OS: Irix 6.5 Submission from: (NULL) (195.110.4.98) the following doesn't give what I expect> test _ factor(ORGMORE[[1]],exclude=c(NA,"NOM"))Warning message: NAs introduced by coercion> levels(test)[1] "CYT" "EXC" "MEM" "NOM" "NUC" "SEC" while this works...> test _ factor(ORGMORE[[1]],levels=c("CYT","EXEC","MEM","NUC","SEC"),exclude=NA) > levels(test)[1] "CYT" "EXEC" "MEM" "NUC" "SEC" All apologies if I misunderstood the help page for the factor() function and this is not strange... (I mean the results obtained, not my understanding of the help pages =) ). -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
1999-Sep-02 17:55 UTC
trouble with the 'exclude' parameter of factor() (PR#265)
On Thu, 2 Sep 1999 gautier@lion-ag.de wrote:> Full_Name: Laurent Gautier > Version: 0.65.0 > OS: Irix 6.5 > Submission from: (NULL) (195.110.4.98) > > > the following doesn't give what I expect > > > test _ factor(ORGMORE[[1]],exclude=c(NA,"NOM")) > Warning message: > NAs introduced by coercion > > levels(test) > [1] "CYT" "EXC" "MEM" "NOM" "NUC" "SEC"For another posting of yours, I assume the x argument is a factor. Now ?factor is missing an arguments section, but if x is a factor, exclude has to be a factor too (with the same set of levels plus perhaps NA), or coercible to factor codes. So please try factor(as.character(ORGMORE[[1]]), exclude=c(NA,"NOM"))> while this works... > > > test _ factor(ORGMORE[[1]],levels=c("CYT","EXEC","MEM","NUC","SEC"),exclude=NA) > > levels(test) > [1] "CYT" "EXEC" "MEM" "NUC" "SEC" > > > All apologies if I misunderstood the help page for the factor() function and > this is not strange... > (I mean the results obtained, not my understanding of the help pages =) ).We definitely need to document the arguments, probably make this friendlier. PS: as Irix 6.5 is not in the PLATFORMS list, please do us a favour and submit a PLATFORMS report. -- Brian D. Ripley, ripley@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-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._