New codes() methods

Jonathan Rougier Jonathan Rougier <>
Thu, 4 Nov 1999 11:48:06 +0000 (GMT)

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)

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
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: