tbl_ancova: Table difference between two groups

Description Usage Arguments Example Output Author(s) Examples

View source: R/tbl_ancova.R

Description

Returns an ANCOVA table showing the means of two groups and the difference in means

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
tbl_ancova(
  data,
  y,
  x,
  formula = "{y} ~ {x}",
  label = NULL,
  method.args = NULL,
  conf.level = 0.95,
  estimate_fun = NULL,
  pvalue_fun = NULL,
  method = stats::lm,
  digits = NULL
)

Arguments

data

frame to be used in ANCOVA models

y

vector of continuous outcome variables. One-way ANOVA/ANCOVA models will be computed for each outcome.

x

string indicating the binary comparison variable

formula

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

label

List of formulas specifying variables labels, e.g. list(age ~ "Age", stage ~ "Path T Stage")

method.args

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

conf.level

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

estimate_fun

Function to round and format coefficient estimates. Default is style_sigfig when the coefficients are not transformed, and style_ratio when the coefficients have been exponentiated.

pvalue_fun

Function to round and format p-values. Default is style_pvalue. The function must have a numeric vector input (the numeric, exact p-value), and return a string that is the rounded/formatted p-value (e.g. pvalue_fun = function(x) style_pvalue(x, digits = 2) or equivalently, purrr::partial(style_pvalue, digits = 2)).

method

Regression method (e.g. lm, glm, survival::coxph, survey::svyglm, and more).

digits

List of formulas specifying the number of decimal places to round continuous summary statistics. If not specified, tbl_summary guesses an appropriate number of decimals to round statistics. When multiple statistics are displayed for a single variable, supply a vector rather than an integer. For example, if the statistic being calculated is "{mean} ({sd})" and you want the mean rounded to 1 decimal place, and the SD to 2 use digits = list(age ~ c(1, 2)). User may also pass a styling function: digits = age ~ style_sigfig

Example Output

Author(s)

Daniel D. Sjoberg

Examples

1
2
3
tbl_ancova_ex1 <-
  trial %>%
  tbl_ancova(y = c("age", "marker"), x = "trt")

ddsjoberg/bstfun documentation built on May 4, 2021, 9:39 a.m.