Try this: diag(sapply(all.predicted.values, '[[', 'max.growth'))
On Mon, Oct 18, 2010 at 12:59 PM, Gregory Ryslik <rsa...@comcast.net> wrote: > Hi, > > I have a list of n items and the ith element has m_i elements within it. > > I want to do something like: > > predicted.values<- lapply(all.predicted.values,'[[',max.growth[[i]]) > > Where max.growth[[i]] is the element I want to extract from each of the ith > predicted elements. Thus, for example, I want to extract the max.growth[[1]] > element from all.predicted.values[[1]] (which is itself a list). Then I > want to extract max.growth[[2]] element from all.predicted.values[[2]]. > > I realize I can do this with a for loop but then if I can do this as one > line that would be preferable. > > Thanks! > > Greg > [[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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.