[R] Extracting objects from a list of matrix

kjetil brinchmann halvorsen kjetil at entelnet.bo
Sat Sep 20 16:11:04 CEST 2003


On 19 Sep 2003 at 8:43, ZABALZA-MEZGHANI Isabelle wrote:

[
is a function:

> test <- list(a=1, b=2, c=3)
> "["(test,2)
$b
[1] 2


Kjetil Halvorsen

> Hello,
> 
> I would like to have an advise about how to extract objects from a list of
> matrixs
> I have fitted models (stored in an object called "model") using a matrix
> response and the same formula and data. I get back, from summary.lm, as many
> sumarries as I have responses.
> Thus I have extract the coefficient matrix for each model with the following
> command :
> 
> coefficients(summary(model))
> 
> My goal is only to get the "t values" for each model. Generally to extract a
> colum from a matrix I do [,"t value"], and to apply a function to a list I
> use lapply. But here, I can not manage to extract the columns, since the
> "[]" function, is not really a function with arguments ...
> 
> Can someone give me a solution ? (in avoiding to make a loop around my list
> components).
> 
> Thanks in advance,
> 
> Isabelle.
> 
> 
> Isabelle Zabalza-Mezghani
> IFP - Reservoir Engineering Department
> Rueil-Malmaison - France
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list