Re: New codes() methods

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

Subject: Re: New codes() methods
From: Jonathan Rougier (J.C.Rougier@durham.ac.uk)
Date: Thu 04 Nov 1999 - 21:48:06 EST


Message-ID: <Pine.GSO.3.96.991104114005.16942B-100000@laplace>

Hi Peter,

On 4 Nov 1999, Peter Dalgaard BSA wrote:

> Looks quite nice. Two things have me worried, though:
>
> 1) do we really want to convert anything to factors? (try factor(rnorm(10000)))

I agree that this would be undesirable, but not necessarily wrong!

> 2) if a dataframe contains a matrix, it gets converted to something
> with incompatible lengths

This was part of my motivation for including a matrix case in the default
behaviour, but in the end I thought that the error message might be
justified! But the alternative would be

    ...
    else if (is.matrix(x))
      apply(t(x), 1, codes)
    else
      codes(factor(x))

but, as I mentioned before, this makes an unwarranted assumption about the
interpretation of the rows and columns of x.

Cheers, Jonathan.

Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be
 weighed in the scale with what we know" (Meredith, 1879, The Egoist)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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:09 EST