Re: trouble with the 'exclude' parameter of factor() (PR#265)

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: trouble with the 'exclude' parameter of factor() (PR#265)
ripley@stats.ox.ac.uk
Date: Fri 03 Sep 1999 - 03:55:14 EST


Message-Id: <199909021755.TAA19894@pubhealth.ku.dk>

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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:08 EST