I've recently read this section of the R Language Definition and become very confused. It says:
For vectors and matrices the
[[forms are rarely used, although they have some slight semantic differences from the[form (e.g. it drops any names or dimnames attribute, and that partial matching is used for character indices).
Am I misreading it? It seems to say that [[ allows partial matching (presumably by default) for named vectors and matrices. However, I know this to be obviously false:
> lett<-setNames(sample(26),paste0(letters,letters,letters))
> lett[["aaa"]]#No partial match
[1] 23
> lett[["a"]]#Error
Error in lett[["a"]] : subscript out of bounds
so what did the language definition mean? It could be talking about the exact=FALSE flag that you can set, but this seems a very strange way to do that. In fact, a later section makes the following claim, which my above code disproves, so I'm even more confused:
For
[[and$partial matching is used if exact matching fails, sox$aawill matchx$aabbifxdoes not contain a component named "aa" and "aabb" is the only name which has prefix "aa". For[[, partial matching can be controlled via the exact argument which defaults toNAindicating that partial matching is allowed, but should result in a warning when it occurs.
Is the language definition simply out of date?