From michael.hoehle at gmail.com  Thu Jan 17 20:50:33 2008
From: michael.hoehle at gmail.com (michael.hoehle at gmail.com)
Date: Thu, 17 Jan 2008 20:50:33 +0100 (CET)
Subject: [Rd] Problematic sentence in Section 6.1 (Lists) of "An
	introduction to R" (PR#10583)
Message-ID: <20080117195033.66AB12834843@mail.pubhealth.ku.dk>

Full_Name: Michael H?hle
Version: 2.7.0
OS: Mac Os X 10.4.11
Submission from: (NULL) (84.153.81.41)


Dear R developers,

this is not really a bug, but I was confused by the following sentence in
Section 6.1 on lists in "An introduction to R" available from e.g.
http://cran.r-project.org/doc/manuals/R-intro.html#Lists-and-data-frames

Here it says that:

Additionally, one can also use the names of the list components in double square
brackets, i.e., Lst[["name"]] is the same as Lst$name. 
                              ^^^^^^^^^^^
In the above context this might be right, but if one operates with named lists
the $ notation handles abbrevations, whereas the [[]] notation does not.
As a consequence I was surprised by the following code:

control <- list(nameSpace=1) 
if (is.null(control$name)) control$name <- TRUE

Here control$name is recognized as control$nameSpace and thus control$name is
assigned the value TRUE. Had one used control[["name"]] then things would have
worked differently.  Thus Lst[["name"]] might not be the same as Lst$name. 

I admit the entire case might be pedantic, but maybe an extra sentence could
help.
Just a suggestion.



[Rd] Problematic sentence in Section 6.1 (Lists) of "An introduction to R" (PR#10583)
michael.hoehle at gmail.com