Skip to content
Prev 168988 / 398506 Next

Difference between a[[i]] and a[i]

I'm sure I've read about the difference between a[[i]] and a[i] in R, but I
cannot recall what I read. Even more disturbing is the fact that I don't
know how to search the newsgroup for this. All the different combinations I
tried were declared not to be valid search syntax.

1. What sort of object can the operators [] and [[]] be applied to? How do
they differ? I mean objects in standard R, not in packages that provide
conceivable overloading of these operators (if that's possible).
2. Meta-question: how could one search for an answer to this question in the
newsgroup?
3. Meta-question: how could one search for an answer to this in the FAQ?
4. Meta-question: how could one search for an answer to this in any of the
links one is shown after typing help.start()?

Thanks for any help.
David