[Rd] names<- bug or feature?

Patrick Burns pburns at pburns.seanet.com
Fri May 23 20:22:27 CEST 2008


The two statements below with 'names' are conceptually
the same.  The second performs the desired operation
while the first does not.

 > xx <- list(A=c(a=1, b=2))
 > names(xx$A[1]) <- "changed"
 > xx
$A
a b
1 2

 > names(xx$A)[1] <- "changed"
 > xx
$A
changed       b
      1       2

This is observed in 2.4.0 on Linux as well as 2.7.0 and
2.8.0  on Windows XP.


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")



More information about the R-devel mailing list