display_linear2: Display linear regression results (given variable names)

display_linear2R Documentation

Display linear regression results (given variable names)

Description

Given a string with an "outcome" and a vector string with "predictors", univariable and (optionally) multivariable results from linear regression are displayed in a format suitable for presentation.

This version allows you to explicitly provide the outcome and predictors in case there are issues with getting a full model fit.

Usage

display_linear2(
  data,
  outcome,
  predictors,
  add_multi = FALSE,
  format = "html",
  conf_level = 0.95,
  include_last_row = TRUE
)

Arguments

data

A tibble or data frame with the full data set.

outcome

Character string. The dependent variable (outcome) for linear regression.

predictors

Character vector. Independent variables (predictors/covariates) for univariable and/or multivariable modelling.

add_multi

Logical; include multivariable results. Default is FALSE.

format

Display format in case I need to escape some characters. A placeholder for now in case I need it in the future. Default is "html".

conf_level

The confidence level to use for the confidence interval. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

include_last_row

Adds a row at the end of each set of results to give some breathing room. Default is TRUE.

Value

A tibble with regression results.

Examples

## Not run: 
display_linear2(data = mtcars,
                outcome = "mpg",
                predictors = c("cyl", "disp"))

display_linear2(data = mtcars,
                outcome = "mpg",
                predictors = c("cyl", "disp"),
                add_multi = TRUE)

## End(Not run)

emilelatour/latable documentation built on Nov. 25, 2024, 4:58 a.m.