multiformat_lm: : Format a given list of lm() regression objects for easy...

Description Usage Arguments Value Examples

Description

: Given a list of OLS regressions, *performed using lm()* format, return and optionally, write the results side-by-side in a csv.

Usage

1
2
multiformat_lm(lm_list, output_file = NA, formula_list = NA,
  title_list = NA, ndigit = 5)

Arguments

lm_list

a list() of lm model objects (list of lm objects)

output_file

the file path (with ".csv" extension) to write the results to, if no value provided, no output file will be created (character)

formula_list

optional list of custom formulae to provide to print in results (code pulls regression formula call by default) (list of character)

title_list

optional list of titles for each regression in the list to write atop output file (blank by default) (list of character)

ndigit

level of precision in output, 5 by default (integer)

Value

matrix containing formatted results from the provided regression list (matrix)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
dem_dia <- merge(x = dem, y = dia, by = "empi", all.y = TRUE)
dem_dia[, pt_dia_count := .N, by = "empi"]
pt_dem_dia <- unique(dem_dia, by = "empi")
lm_dia_count_age <- lm(pt_dia_count ~ age, data = pt_dem_dia)
lm_dia_count_age_gender <- lm(pt_dia_count ~ age + gender, data = pt_dem_dia)
lm_dia_count_age_gender_race <- lm(pt_dia_count ~ age + gender + race, data = pt_dem_dia)
lm_list <- list(lm_dia_count_age, lm_dia_count_age_gender, lm_dia_count_age_gender_race)
multiformat_lm(lm_list = lm_list, output_file = "dia_count_lm_variation.csv")

## End(Not run)

ClaraMarquardt/ehR documentation built on May 6, 2019, 12:02 p.m.