On Thu, 2018-03-01 at 09:36 -0500, Ron wrote: > Hello, > > I'd like to report what I think is a bug: using as.data.frame() we can > create duplicate row names in a data frame. R version 3.4.3 (current stable > release). > > Rather than paste code in an email, please see the example formatted code > here: > https://stackoverflow.com/questions/49031523/duplicate-row-names-in-r-using-as-data-frame > > I posted to StackOverflow, and consensus was that we should proceed with > this as a bug report.
Yes that is definitely a bug. The end of the as.data.frame.matrix method has: attr(value, "row.names") <- row.names class(value) <- "data.frame" value Changing this to: class(value) <- "data.frame" row.names(value) <- row.names value ensures that the row.names<-.data.frame method is called with its built -in check for duplicate names. There are quite a few as.data.frame methods so this could be a recurring problem. I will check. Martyn > Thanks, > Ron > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel