Re: BUG in format()? (PR#383)

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

Subject: Re: BUG in format()? (PR#383)
From: Kurt Hornik (Kurt.Hornik@ci.tuwien.ac.at)
Date: Wed 22 Dec 1999 - 20:28:42 EST


Message-ID: <14432.42970.613486.58857@aragorn.ci.tuwien.ac.at>

>>>>> Prof Brian D Ripley writes:

> On Tue, 21 Dec 1999 jens.oehlschlaegel-akiyoshi@mdfactory.de wrote:
>>
>>
>> In RW0.651 and RW0.901,
>> I discovered some unexpected behaviour when I used as.matrix.data.frame()
>>
>> > matrix('"', 2, 2)
>> [,1] [,2]
>> [1,] "\"" "\""
>> [2,] "\"" "\""
>> > unclass(as.data.frame(matrix('"', 2, 2)))
>> $V1
>> [1] "\"" "\""
>>
>> $V2
>> [1] "\"" "\""
>>
>> attr(,"row.names")
>> [1] "1" "2"

> Now that is unexpected. The components should be factors. The code
> converting matrices to data frames is not behaving as the prototype,
> and that explains the rest, as the prototype gets the answer you would
> expect. The rule is supposed to be that adding a matrix is equivalent to
> adding each column in turn (White Book, page 59, and the S code).

> I am not aware of any documentation of an R difference here (but I may
> be wrong, although I checked the FAQ), and we need to fix either
> as.data.frame.matrix or as.matrix.data.frame. I will argue for the
> first.

Definitely. The docs say that it (in fact, as.data.frame()) will do
type conversion, but it simply does not.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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:11 EST