Hi Jason, try using comma's instead of colons. eg a[[c(1,6)]], a[[c(3,6)]] etc...
If you use a[[1:3]] this is equivalent to a[[c(1,2,3)]]. As the list only contains 2 levels, this will give an error or NULL , depending on your R version. More info you find by ?"[[" Cheers Joris On Tue, Mar 30, 2010 at 5:47 PM, Dgnn <sharkbrain...@gmail.com> wrote: > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.