[R] Transforming matrix to data.frame: problems

Don MacQueen macq at llnl.gov
Sat Nov 10 00:23:32 CET 2001


At 8:46 PM +0100 11/9/01, Agustin Lobo wrote:
>Hi all,
>
>I have problems transforming a matrix
>into a data.frame:
>
>If I do:
>
>>  is.matrix(parcelas.cobtot.conti)
>[1] TRUE
>  > dim(parcelas.cobtot.conti)
>[1] 25 64
>
>  > a  <- data.frame(parcelas.cobtot.conti)
>>  is.data.frame(a)
>[1] TRUE
>>
>>  dim(a)
>[1] 1600    3
>
>Why a does not have the same dimensions than
>parcelas.cobtot.conti?
>
>

...

What does
   a[1:3,]
look like? Compared with, perhaps,
   parcelas.cobtot.conti[1:2,]

This may suggest something.

It is probably not a coincidence that
>  25*64
[1] 1600

It might be worth trying
   as.data.frame(parcelas.cobtot.conti)

-Don
-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
--------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list