Skip to content
Back to formatted view

Raw Message

Message-ID: <x2bt1p2r3h.fsf@blueberry.kubism.ku.dk>
Date: 2000-05-29T17:39:30Z
From: Peter Dalgaard
Subject: Getting a vector of list component components...
In-Reply-To: Kjetil Kjernsmo's message of "Mon, 29 May 2000 19:31:22 +0200 (MET DST)"

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._