From pburns at pburns.seanet.com  Fri May 23 20:22:27 2008
From: pburns at pburns.seanet.com (Patrick Burns)
Date: Fri, 23 May 2008 19:22:27 +0100
Subject: [Rd] names<- bug or feature?
Message-ID: <48370B63.4040309@pburns.seanet.com>

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")



[Rd] names<- bug or feature?
Patrick Burns