[R] save lm output into vectors

jim holtman jholtman at gmail.com
Wed Oct 10 14:33:02 CEST 2007


It really depends on what you want to do with the values.  If you are
computing these in a loop, then I would suggest that you store the
output of 'summary' in a list and you can then extract the values
later.  Can you provide an idea of what you want to do with them and
how you are computing them.  An example of code would help a lot.

Here is one way to do it:

result <- list()
for (i in something){
    ...computation..
    result[[i]] <- summary(lm(.....))
}
# access some coefficients
coefficients(result[[1]])



On 10/9/07, Jiong Zhang, PhD <jizhang at chori.org> wrote:
> Hi,
>
> May I ask how I can save the coefficients and the p values into a table?
>
> thanks.
>
> jiong
>  The email message (and any attachments) is for the sole...{{dropped:11}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list