[another spill over from R-core
concering the new behavior of as.numeric(.) for factors. - MM]
>>>>> "Ross" == Ross Ihaka
<ihaka@stat.auckland.ac.nz> writes:
Ross> Thomas Lumley writes:
> On 27 Dec 1997, Peter Dalgaard BSA wrote:
> > Thomas Lumley <thomas@biostat.washington.edu> writes:
> >
> > > Now as.numeric() operates on the levels of the factor
> > > > as.numeric(factor(c("2","3")))
> > > [1] 2 3
> > > > as.numeric(factor(c("A","B")))
> > > [1] NA NA
> > >
> > > Is this new behaviour a feature? If so, we need to document it
in the FAQ
> > > and the help page.
> >
> > I seem to remember that it got changed in S-plus 3.4 -> 4.0 ? I
also
> > prefer the old behavior, but perhaps codes() is better anyway?
codes(.) is now well documented.
Maybe we should add some extra like
Note that \code{\link{as.numeric}(f)} does \emph{not} give the same as
\code{codes(f)}. This is not compatible to version of Splus prior to 4.0
>> We are entirely Unix-based here, so I haven't seen Splus 4.0.
I'm
>> happy to have the new version of as.numeric but I think it needs
>> documentation as an incompatibility at least with Unix S(-PLUS).
Ross> Mea culpa. I as attempting to get rid of what I though was an S
Ross> incompatibility and succeeded in replacing it with another.
Ross> I'm not very happy with:
>> as.numeric(factor(c(100, 200)))
Ross> [1] 1 2
Ross> but I can live with it.
Ok, I've now checked it on our PC (S-plus 4.0):
This is the same as S 4 ("L"), S-plus 3.4 and S-plus 4.0
On the other hand,
> as.numeric(factor(c("A","B")))
[1] NA NA
is not compatible to any version of S-plus or S 4
and I now wonder if we shouldn't go for compatibility here.
- Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._