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

William Dunlap wdunlap at tibco.com
Tue Mar 6 17:57:17 CET 2012

S+ does allow duplicates in the row names if you ask for them
to be allowed (with data.frame(..., dup.row.names=TRUE) or
attr(df, "dup.row.names") <- TRUE).

They were allowed because bootstrappers were sampling the
rows of data.frames with replacement and it turned out that
a fair bit of time was being used calling make.unique() on
the row names of the sample.

There may be better solutions to that problem, but that is
why S+ allows them.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ajay Askoolum
> Sent: Monday, March 05, 2012 11:42 PM
> To: R General Forum
> Subject: [R] Why aren't row names in a data frame unique?
> 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.
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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