Produce table of counts and percentages for a list of variables in a dataset.

table_np(
  data,
  vars,
  digits = 0,
  comma = FALSE,
  np_only = TRUE,
  header = TRUE,
  var_col = FALSE
)

Arguments

data

Input dataset.

vars

Character vector of variables to get counts and percentages for.

digits

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

comma

Option to use comma separator on thousands.

np_only

Option to return only the combined count and percentage variable.

header

Option to use variable names as headers.

var_col

Option to include variable name as a separate column.

Value

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

Examples

if (FALSE) { # \dontrun{
table_np(dat, c("var1", "var2"), digits = 1)
} # }