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? I've tested with caith and the behaviour there is different:> data(caith) > is.data.frame(caith)[1] TRUE> dim(caith)[1] 4 5> a <- as.matrix(caith) > dim(a)[1] 4 5> b <- data.frame(a) > dim(b)[1] 4 5 What can be wrong with parcelas.cobtot.conti ? I'd appreciate any help Thanks, Agus Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 alobo at ija.csic.es -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Agustin Lobo <alobo at ija.csic.es> writes:> 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 can be wrong with parcelas.cobtot.conti ? > I'd appreciate any helpAnything interesting coming out of str(parcelas.cobtot.conti) ? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._