Jim, have a look here: 
http://www.r-bloggers.com/select-operations-on-r-data-frames/. Specifically at 
the Duplicate Row Names section towards the end of the page.



________________________________
 From: Jim Lemon <j...@bitwrit.com.au>

Cc: R General Forum <r-help@r-project.org> 
Sent: Tuesday, 6 March 2012, 9:42
Subject: Re: [R] Why aren't row names in a data frame unique?

On 03/06/2012 06:42 PM, Ajay Askoolum wrote:
> I expected the row names to be unique but a data frame appears to be able to 
> hold duplicate row names. This makes me thing that there must be 
> circumstances when it is necessary. However, I cannot think of any. Please 
> enlighten me.
> 
Hi Ajay,
An example of how you managed to do this would be helpful. I tried it:

dodo<-data.frame(a=1:3,b=4:6)
dodo
  a b
1 1 4
2 2 5
3 3 6
rownames(dodo)<-c("s","t","s")
Error in `row.names<-.data.frame`(`*tmp*`, value = value) :
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': ‘s’

Jim
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to