[R] Matrix to data frame conversion

David L Carlson dcarlson at tamu.edu
Mon Nov 12 21:23:48 CET 2012


The problem seems to be that at least two of the 90 rows of your matrix have
the same rowname (called dimnames in a matrix). When you converted to .csv,
the rownames were added as a variable (called X) so they were not checked
for duplicates.

Try length(unique(test$X)). You should get a number less than 90.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of PavloEs
> Sent: Monday, November 12, 2012 1:09 PM
> To: r-help at r-project.org
> Subject: Re: [R] Matrix to data frame conversion
> 
> May be I have not clearly explained my problem. Le me try it again.  My
> problem was with the matrix "comb_model0" . I have tried to convert it
> to a
> data frame (xx), but could not succeed . As a result I have exported it
> to a
> test.csv file  and re-imported  it.  Data frame test  is the product of
> that
> import.  Thus my problem is with the matrix "comb_model0", the first
> part of
> my post, not the csv portion.
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Matrix-to-
> data-frame-conversion-tp4649311p4649331.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list