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.

ff_row_totals(df.in, .data, dependent, explanatory,
  missing_column = TRUE, 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, 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.

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)
#> Note: dependent includes missing data. These are dropped.
#> label Total N Missing N levels Alive Died #> Age 915 0 <40 years 31 (6.1) 36 (8.9) #> 40-59 years 208 (40.7) 131 (32.4) #> 60+ years 272 (53.2) 237 (58.7) #> Sex 915 0 Female 243 (47.6) 194 (48.0) #> Male 268 (52.4) 210 (52.0) #> Obstruction 894 21 No 408 (82.1) 312 (78.6) #> Yes 89 (17.9) 85 (21.4) #> Perforation 915 0 No 497 (97.3) 391 (96.8) #> Yes 14 (2.7) 13 (3.2)