Kjetil Kjernsmo
2000-May-29 17:31 UTC
[R] Getting a vector of list component components...
Dear all, I have a list of htest objects, and I want a vector of e.g. p.values. Is there a simple way of doing this...? I got the desired result with apply(cbind(1:1000), 1, function(i) chisq1M11[[i]]$p.value) but it doesn''t seem very elegant to me... I was thinking along the lines of chisq1M11[[]]$p.value, chisq1M11[[1:1000]]$p.value or something like that.... Or using attach() in some way, or... Best, Kjetil -- Kjetil Kjernsmo Graduate astronomy-student Problems worthy of attack University of Oslo, Norway Prove their worth by hitting back E-mail: kjetikj at astro.uio.no - Piet Hein Homepage <URL:http://www.astro.uio.no/~kjetikj/> Webmaster at skepsis.no -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2000-May-29 17:39 UTC
[R] Getting a vector of list component components...
Kjetil Kjernsmo <kjetil.kjernsmo at astro.uio.no> writes:> Dear all, > > I have a list of htest objects, and I want a vector of e.g. p.values. Is > there a simple way of doing this...? > I got the desired result with > apply(cbind(1:1000), 1, function(i) chisq1M11[[i]]$p.value) > but it doesn''t seem very elegant to me... I was thinking along the lines > of chisq1M11[[]]$p.value, chisq1M11[[1:1000]]$p.value or something like > that.... Or using attach() in some way, or...How about sapply(chisq1M11,function(x)x$p.value) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._