Takes either a data.frame or an ipw object and cycles through all of the given variables and computes summary statistcs across levels of treatment. Standardized mean difference and a distribution plot can also be added to the plot.

make_table1(
  obj,
  treat = NULL,
  ...,
  vr = NULL,
  use_treat_vars = FALSE,
  tab_stat = "Mean",
  tab_stat2 = "SD",
  smd = F,
  smd_lower_limit = FALSE,
  round = 2,
  format = "markdown",
  collapse.columns = FALSE,
  graph = FALSE,
  side.by.side = FALSE,
  caption = "",
  totaln = TRUE,
  table_footer = "",
  colors = "Dark2",
  theme = "basic"
)

Arguments

obj

Either a cmprisk object or a data.frame, if a data.frame then a treatment variable must be specified if it is to be used

treat

The stratifying/treatment variable. If the obj is a data.frame then treat is the first variable specified after the obj, whereas if it is an ipw object, then the treatment variable was previously specified in the model. It can also be omitted by entering all of the variables in the vr statement.

...

The covariates to be used in the table

vr

The variable(s) which should be included in the table. If null, then all of the variables within ... are included in the table. It defaults to null.

use_treat_vars

In addition to variables passed by the user, also include variables from treatment model in table

tab_stat

The type of statistic you want reported for continuous variables, options should be either "Mean" (default) or "Median"

tab_stat2

The secondary statistic, options should be either "SD" (default) for standard deviation, "CI" for confidence intervals, or "IQR" for inter-quartile range of the median

smd

Should the standardized mean difference be displayed, default = FALSE

smd_lower_limit

Should smd display show '<0.01' for small values

round

The number of decimals results should be displayed

format

Deprecated. You can add/modify format my modifying output gt object.

collapse.columns

Deprecated. You can add/modify table my modifying output gt object.

graph

Returns a distribution graph (default = FALSE)

side.by.side

Should both the unweighted and weighted estimates be presented in the same table, defaults to FALSE, not available for non-ipwrisk objects

caption

Deprecated. You can add/modify caption my modifying output gt object.

totaln

Should n = be presented for each stratified group, defaults to TRUE

table_footer

Deprecated. You can add/modify footer my modifying output gt object.

colors

The color scheme used for distribution graphs (when applicable)

theme

Appearance of table, can be either "basic" or "jama"

Value

Returns a gt object

Author

Bassim F Eledath, Angela Cook, Alex Breskin

Examples

if (FALSE) {
make_table1(example1, Statin, DxRisk, Frailty, Sex, graph = TRUE)
make_table1(example1, Statin, vr = c("DxRisk", "Frailty", "Sex"), graph = TRUE)
make_table1(example1, vr = c("DxRisk", "Frailty"))
make_table1(example1, Statin, DxRisk, Frailty, Sex, graph = TRUE)
make_table1(example1, Statin, DxRisk, Frailty, Sex, graph = TRUE, smd = TRUE)
make_table1(example1, Statin, DxRisk)
}