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

Carl Witthoft carl at witthoft.com
Tue Feb 3 23:41:58 CET 2009


I think the thing that escaped me for quite a while was tracking down 
the syntax to specify elements of a list element:


x[[5]][3:7]  to get items from within the 5th element of x.


Seems IIRC there are some types of variables for which the form

x$thing[3:7]  fails and others for which it works fine (where the fifth 
element of x is named 'thing').  But I might be dreaming.

Carl




More information about the R-help mailing list