From Kurt.Hornik@ci.tuwien.ac.at  Wed Dec 22 10:28:42 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Wed, 22 Dec 1999 11:28:42 +0100 (CET)
Subject: BUG in format()? (PR#383)
In-Reply-To: <Pine.GSO.4.05.9912211832220.6587-100000@auk.stats>
References: <199912211639.RAA02470@pubhealth.ku.dk>
 <Pine.GSO.4.05.9912211832220.6587-100000@auk.stats>
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


BUG in format()? (PR#383)
Kurt Hornik