Produce table of counts of outcome by variable, and percentage of full data within group.

table_np_outcome(
  data,
  outcome,
  vars,
  digits = 0,
  np_only = TRUE,
  var_col = FALSE
)

Arguments

data

Input dataset.

outcome

Binary variable with outcome as "1".

vars

Character vector of variables to get counts and percentages for.

digits

Number of digits to use after the decimal point in percentages.

np_only

Option to return only the combined count and percentage variable.

var_col

Option to include variable name as a separate column.

Value

Data frame with counts and percentages of outcome for a list of variables.

Examples

if (FALSE) { # \dontrun{
table_np_outcome(data, outcome = "death", c("var1", "var2"))
} # }