Aashiq Reza
Aashiq Reza

Reputation: 163

How to get the summary from lm() in a table?

I have trained lm model on a dataset and generated the summary of the model using summary() function. How to get the summary in a table?

Upvotes: 0

Views: 1185

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 388962

You can use broom::tidy :

model <- lm(mpg~cyl, mtcars)
broom::tidy(model)

#  term        estimate std.error statistic  p.value
#  <chr>          <dbl>     <dbl>     <dbl>    <dbl>
#1 (Intercept)    37.9      2.07      18.3  8.37e-18
#2 cyl            -2.88     0.322     -8.92 6.11e-10

Upvotes: 2

Related Questions