[R] Problem with duplicates in row.names
arun
smartpink111 at yahoo.com
Mon Sep 10 14:01:07 CEST 2012
Hi Rolf,
I suggested that in matrix, duplicate row names are possible.
set.seed(1)
dat1<-data.frame(a=sample(1:50,5,replace=TRUE),b=rnorm(5,15))
dat2<-as.matrix(dat1)
row.names(dat2)<-rep("a",5)
A.K.
----- Original Message -----
From: Rolf Turner <rolf.turner at xtra.co.nz>
To: Fred <frederic.stadler at unifr.ch>
Cc: r-help at r-project.org
Sent: Sunday, September 9, 2012 4:26 PM
Subject: Re: [R] Problem with duplicates in row.names
On 10/09/12 01:52, Fred wrote:
> Thanks Arun,
> I can manage something with that, just need then to delete the first raw
> with photoshop !
Huh? WTF?
If you're doing that then you're doing something completely wrong
and not understanding how R works.
You didn't include the context of your question, but my vague recollection
is that you want to have "duplicated row names" --- which of course is
not allowed. So include a first column of your data frame consisting of
these duplicated "names". Then if you don't want to see the unduplicated
row names (row numbers) in the final result, write the data frame to your
file setting row.names=FALSE.
cheers,
Rolf Turner
______________________________________________
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