This function has been superseeded by tab_survey() please use that function instead.

tabulate_survey(
  x,
  var,
  strata = NULL,
  pretty = TRUE,
  wide = TRUE,
  digits = 1,
  method = "logit",
  na.rm = FALSE,
  deff = FALSE,
  proptotal = FALSE,
  rowtotals = FALSE,
  coltotals = FALSE
)

Arguments

x

a survey design object

var

the bare name of a categorical variable

strata

a variable to stratify the results by

pretty

if TRUE, default, the proportion and CI are merged

wide

if TRUE (default) and strata is defined, then the results are presented in a wide table with each stratification counts and estimates in separate columns. If FALSE, then the data will be presented in a long format where the counts and estimates are presented in single columns. This has no effect if strata is not defined.

digits

if pretty = FALSE, this indicates the number of digits used for proportion and CI

method

a method from survey::svyciprop() to calculate the confidence interval. Defaults to "logit"

na.rm

When TRUE, missing (NA) values present in var will be removed from the data set with a warning, causing a change in denominator for the tabulations. The default is set to FALSE, which creates an explicit missing value called "(Missing)".

deff

a logical indicating if the design effect should be reported. Defaults to "TRUE"

proptotal

if TRUE and strata is not NULL, then the totals of the rows will be reported as proportions of the total data set, otherwise, they will be proportions within the stratum (default).

rowtotals

if TRUE and strata is defined, then an extra "Total" column will be added tabulating all of the rows across strata.

coltotals

if TRUE a new row with totals for each "n" column is created.

Value

a long or wide tibble with tabulations n, ci, and deff