Skip to content
Prev 168999 / 398506 Next

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

On 3/02/2009, at 12:45 PM, David Epstein wrote:

            
Essentially: a is a list; a[i] is a list of length 1 whose sole entry is
the i-th entry of a; a[[i]]] is the i-th entry of a.  If you are of a
mathematical bent it may be illuminating to think of this as being  
analogous
to, say, {3} being a subset of the set {1,2,3,4,5} and 3 being an  
element
of this set.
Essentially lists.  Note that any vector can be considered to be a list.
Note that data frames are lists.
RSiteSearch("[") or RSiteSearch("[[")
Doesn't seem to be there, AFAICS.
Click on ``Search Engine and Keywords''; then search on ``[[''.  Then
click on ``Extract''.  This last is less than totally perspicuous. ;-)

Instead of trying to follow these links, just do

	?"[" or ?"[["

HTH.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}