ZABALZA-MEZGHANI Isabelle wrote:

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

Why not? Try e.g.:


X <- matrix(1:4, 2)
"["(X,,2)

So in order to solve your problem try:

lapply(YourList, "[", , "t-value")

or use an anonymous function:

lapply(YourList, function(x) x[, "t-value"])


Uwe Ligges




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

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



lapply(....., function(x) x[,"t value"])


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to