The fmt_uni_regression function arguments are similar to the fmt_regression arguments. Review the fmt_uni_regression vignette for detailed examples.

fmt_uni_regression(data, method, y, method.args = NULL,
  formula = "{y} ~ {.x}", exponentiate = FALSE, label = NULL,
  show_yesno = NULL, conf.level = 0.95, beta_fun = fmt_beta,
  pvalue_fun = fmt_pvalue)

Arguments

data

Data frame to be used in univariate regression modeling. Data frame includes the outcome variable(s) and the independent variables.

method

Regression method (e.g. lm, glm, coxph, and more).

y

model outcome as a string (e.g. y = 'recurrence' or y = 'Surv(time, recur)')

method.args

List of additional arguments passed on to the regression function defined by method.

formula

String that becomes the model formula. Uses glue syntax. Default is "{y} ~ {.x}", where {y} is the dependent variable, and {.x} represents a single covariate. For a random intercept, the formula may be formula = "{y} ~ {.x} + (1 | gear)".

exponentiate

logical argument passed directly to broom::tidy(). Default is FALSE

label

list of labels to write in the output. list(age60 = "Age > 60")

show_yesno

Vector of names of categorical and factor variables that are c("No", "Yes"), c("no", "yes"), or c("NO", "YES") default to dichotomous printing (i.e. only Yes shown). To force both levels to be shown include the column name in show_yesno, e.g. show_yesno = c("highgrade", "female")

conf.level

confidence level passed directly to broom::tidy. Default is 0.95.

beta_fun

function to round and format beta coefficients. Default is fmt_beta

pvalue_fun

function to round and format p-values. Default is fmt_pvalue

Examples

fmt_uni_regression( trial, method = "glm", y = "response", method.args = list(family = binomial), exponentiate = TRUE )
#> #> Variable N OR 95% CI p-value #> Treatment Randomization 191 #> Drug Ref. #> Placebo 0.47 0.26, 0.84 0.012 #> Age, yrs 183 1.00 0.98, 1.02 >0.9 #> Marker Level, ng/mL 183 0.92 0.65, 1.30 0.6 #> T Stage 191 #> T1 Ref. #> T2 1.40 0.63, 3.14 0.4 #> T3 0.63 0.26, 1.50 0.3 #> T4 0.50 0.22, 1.11 0.089 #> Grade 191 #> I Ref. #> II 0.60 0.29, 1.25 0.2 #> III 0.76 0.38, 1.51 0.4
# rounding pvalues to 2 decimal places, and adding global p-values fmt_uni_regression( trial, method = "glm", y = "response", method.args = list(family = binomial), exponentiate = TRUE, pvalue_fun = function(x) fmt_pvalue(x, digits = 2) ) %>% add_global()
#> #> Variable N OR 95% CI p-value #> Treatment Randomization 191 0.011 #> Drug Ref. #> Placebo 0.47 0.26, 0.84 #> Age, yrs 183 1.00 0.98, 1.02 0.90 #> Marker Level, ng/mL 183 0.92 0.65, 1.30 0.64 #> T Stage 191 0.055 #> T1 Ref. #> T2 1.40 0.63, 3.14 #> T3 0.63 0.26, 1.50 #> T4 0.50 0.22, 1.11 #> Grade 191 0.40 #> I Ref. #> II 0.60 0.29, 1.25 #> III 0.76 0.38, 1.51