Bug 16570 - Basic data frame manipulation error
Summary: Basic data frame manipulation error
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 3.2.2
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-10-16 15:05 UTC by kerker.doctor
Modified: 2015-10-17 15:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kerker.doctor 2015-10-16 15:05:48 UTC
> y <- data.frame(1:4,5:8)
> y <- y[-2,]
> y[4,] <- 8:9

> y
Error in data.frame(X1.4 = c("1", "3", "4", "8"), X5.8 = c("5", "7", "8",  : 
  duplicate row.names: 4
Comment 1 Peter Dalgaard 2015-10-16 15:40:53 UTC
Yes, that is a bug. 

Also

> y <- data.frame(1:4,5:8)
> rownames(y) <- c(1,2,3,5)
> y[5,] <- 8:9
> y
Error in data.frame(X1.4 = c("1", "2", "3", "4", "8"), X5.8 = c("5", "6",  : 
  duplicate row.names: 5

Still present in r-devel, it seems.
Comment 2 Peter Dalgaard 2015-10-17 15:45:20 UTC
xpdrows.data.frame didn't check that it generated unique row names. Now does (in r-devel, since the urgency seems limited. Example now does

> y <- data.frame(1:4,5:8)
> y <- y[-2,]
> y[4,] <- 8:9 
> y
    X1.4 X5.8
1      1    5
3      3    7
4      4    8
4.1    8    9