Peter Dalgaard BSA writes:
Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> writes:
names(sampled) <- " "
and
dimnames(sampled)[[2]] <- " "
happily introduce non-unique variable names in the data frame.
Is the rule that row.names and names must be unique still on?
Argh ...
Splus 3.4 dispatches on dimnames<-, but not on names<- with the
following curious result:
d <- data.frame(a=1:3,b=4:6)
names(d)<-c(" "," ")
d
dimnames(d)[[1]] <- rep(" ",3)
Error in "dimnames<-.data.frame"(d, .A0): column names must be unique
Dumped
R dispatches similarly, but doesn't check the dimnames in
dimnames<-.data.frame. It could do so quite easily. Just add
|| any(duplicated(d[[1]])) || any(duplicated(d[[2]]))