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,
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"
)
summary_factorlist()
output.
Data frame used to create summary_factorlist()
.
Character. Name of dependent variable.
Character vector of any length: name(s) of explanatory variables.
Logical. Include a column of counts of missing data.
Logical. Include percentage.
Integer length 1. Number of digits for percentage.
Logical. When TRUE, missing data in the dependent variable is included in totals.
Logical. When TRUE, missing data counts for variables are for compelte cases across all included variables.
Character. Name of total column.
Character. Name of missing column.
Data frame.
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 (100.0) 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 (100.0) 0 Female 243 (47.6) 194 (48.0)
#> Male 268 (52.4) 210 (52.0)
#> Obstruction 894 (97.7) 21 No 408 (82.1) 312 (78.6)
#> Yes 89 (17.9) 85 (21.4)
#> Perforation 915 (100.0) 0 No 497 (97.3) 391 (96.8)
#> Yes 14 (2.7) 13 (3.2)