[R] list index rules evaluation behavior

Dgnn sharkbrainpdx at gmail.com
Tue Mar 30 17:47:56 CEST 2010


I have what may be a simple/foolish question, but I've done the due diligence
and looked through pages of posts here as well as several of the PDFs on the
CRAN site, but haven't been able find what I'm after.

I am working with a list of say 3 histogram objects A, B & C, and each
histogram is a list of 7 elements. I would like to access $name, the 6th
element, of histograms A,B and C.


Trial and error yielded some results that told me I clearly don't understand
how R interprets index commands. For the histogram list above:
a[1:2] give histograms A and B as expected.
a[[1:2]] gives the second element of histogram 1, but a[[1:1]] gives all
elements of histogram 1, while a[[1:3]] gives null?!

If anyone could help with an explanation of indexing rules, or a source that
does so, I would very much appreciate it. Oh and an answer to the first
question!

Thanks All

Jason


-- 
View this message in context: http://n4.nabble.com/list-index-rules-evaluation-behavior-tp1745398p1745398.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list