I have been using the broom package's tidy()
function in R to print my model summaries.
However, the tidy()
function returns p-values without stars, which makes it a bit weird for many people who are used to seeing stars in model summaries.
Does anyone know a way to add stars to the output?
We can use a convenient function stars.pval
from gtools
to do this
library(gtools)
library(broom)
library(dplyr)
data(mtcars)
mtcars %>%
lm(mpg ~ wt + qsec, .) %>%
tidy %>%
mutate(signif = stars.pval(p.value))
# term estimate std.error statistic p.value signif
#1 (Intercept) 19.746223 5.2520617 3.759709 7.650466e-04 ***
#2 wt -5.047982 0.4839974 -10.429771 2.518948e-11 ***
#3 qsec 0.929198 0.2650173 3.506179 1.499883e-03 **
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With