Probably worthwhile to augment all comments into an answer.
Both my comment and BenBolker's point to doc page ?Extract
:
Under Recursive (list-like) objects:
Both "[["
and "$"
select a single element of the list. The main difference is that "$"
does not allow computed indices, whereas "[["
does. x$name
is equivalent to x[["name", exact = FALSE]]
. Also, the partial matching behavior of "[["
can be controlled using the exact
argument.
Under Character indices:
Character indices can in some circumstances be partially matched (see ?pmatch
) to the names or dimnames of the object being subsetted (but never for subassignment). Unlike S (Becker et al p. 358), R never uses partial matching when extracting by "["
, and partial matching is not by default used by "[["
(see argument exact
).
Thus the default behaviour is to use partial matching only when extracting from recursive objects (except environments) by "$"
. Even in that case, warnings can be switched on by options(warnPartialMatchDollar = TRUE)
.
Note, the manual has rich information, and make sure you fully digest them. I formatted the content, adding Stack Overflow threads behind where relevant.
Links provided by phiver's comment are worth reading in a long term.