ff_row_totals: Add row totals to 'summary_factorlist()' output

ff_row_totalsR Documentation

Add row totals to summary_factorlist() output

Description

This adds a total and missing count to variables. This is useful for continuous variables. Compare this to summary_factorlist(total_col = TRUE) which includes a count for each dummy variable as a factor and mean (sd) or median (iqr) for continuous variables.

Usage

ff_row_totals(
  df.in,
  .data,
  dependent,
  explanatory,
  missing_column = TRUE,
  percent = TRUE,
  digits = 1,
  na_include_dependent = FALSE,
  na_complete_cases = FALSE,
  total_name = "Total N",
  na_name = "Missing N"
)

finalfit_row_totals(
  df.in,
  .data,
  dependent,
  explanatory,
  missing_column = TRUE,
  percent = TRUE,
  digits = 1,
  na_include_dependent = FALSE,
  na_complete_cases = FALSE,
  total_name = "Total N",
  na_name = "Missing N"
)

Arguments

df.in

summary_factorlist() output.

.data

Data frame used to create summary_factorlist().

dependent

Character. Name of dependent variable.

explanatory

Character vector of any length: name(s) of explanatory variables.

missing_column

Logical. Include a column of counts of missing data.

percent

Logical. Include percentage.

digits

Integer length 1. Number of digits for percentage.

na_include_dependent

Logical. When TRUE, missing data in the dependent variable is included in totals.

na_complete_cases

Logical. When TRUE, missing data counts for variables are for compelte cases across all included variables.

total_name

Character. Name of total column.

na_name

Character. Name of missing column.

Value

Data frame.

Examples

explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = 'mort_5yr'
colon_s %>%
 summary_factorlist(dependent, explanatory) %>%
	ff_row_totals(colon_s, dependent, explanatory)

finalfit documentation built on Sept. 11, 2024, 9:01 p.m.