[R] Getting a vector of list component components...
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon May 29 19:39:30 CEST 2000
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list