Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- make_stars <- function(pval) {
- stars = ""
- if(pval <= 0.001)
- stars = "***"
- if(pval > 0.001 & pval <= 0.01)
- stars = "**"
- if(pval > 0.01 & pval <= 0.05)
- stars = "*"
- if(pval > 0.05 & pval <= 0.1)
- stars = "."
- stars
- }
- library(broom)
- library(dplyr)
- mtcars %>%
- lm(mpg ~ wt + qsec, .) %>%
- tidy() %>%
- mutate(signif = sapply(p.value, function(x) make_stars(x)))
- 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 **
Add Comment
Please, Sign In to add comment