Skip to contents

Produces a stable long-format tabulation using optional grouping variables, a value variable, and an optional expansion factor.

Usage

enemdu_tabulate(
  data,
  group_vars = NULL,
  value = NULL,
  weight = "fexp",
  statistic = c("count", "sum", "mean", "proportion"),
  measure = NULL,
  na_rm = TRUE,
  drop_na_groups = TRUE,
  sample_n_min = 60
)

Arguments

data

A data frame.

group_vars

Optional character vector of grouping variables.

value

Optional value variable. Required for "sum", "mean" and "proportion".

weight

Optional weight variable. Defaults to "fexp" if present. If NULL, unweighted calculations are performed.

statistic

One of "count", "sum", "mean" or "proportion".

measure

Optional name for the output measure.

na_rm

Logical. If TRUE, missing values in value are excluded from sum, mean, and proportion calculations.

drop_na_groups

Logical. If TRUE, records with missing values in any grouping variable are excluded.

sample_n_min

Minimum unweighted sample size used for a preliminary sample-size flag. Defaults to 60.

Value

A tibble with one row per tabulated group.

Details

This function performs basic weighted estimation. It does not yet calculate standard errors, coefficients of variation, effective sample sizes, degrees of freedom, or confidence intervals. Those elements belong to the representativity and precision module.