[R] Why aren't row names in a data frame unique?

Jim Lemon jim at bitwrit.com.au
Tue Mar 6 10:42:43 CET 2012

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:

   a b
1 1 4
2 2 5
3 3 6
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’


More information about the R-help mailing list