ard_continuous.survey.design: ARD Continuous Survey Statistics

View source: R/ard_continuous.survey.design.R

ard_continuous.survey.designR Documentation

ARD Continuous Survey Statistics

Description

Returns an ARD of weighted statistics using the {survey} package.

Usage

## S3 method for class 'survey.design'
ard_continuous(
  data,
  variables,
  by = NULL,
  statistic = everything() ~ c("median", "p25", "p75"),
  fmt_fn = NULL,
  stat_label = NULL,
  ...
)

Arguments

data

(survey.design)
a design object often created with survey::svydesign().

variables

(tidy-select)
columns to include in summaries.

by

(tidy-select)
results are calculated for all combinations of the columns specified, including unobserved combinations and unobserved factor levels.

statistic

(formula-list-selector)
a named list, a list of formulas, or a single formula where the list element is a character vector of statistic names to include. See below for options.

fmt_fn

(formula-list-selector)
a named list, a list of formulas, or a single formula where the list element is a named list of functions (or the RHS of a formula), e.g. ⁠list(mpg = list(mean = \(x) round(x, digits = 2) |> as.character))⁠.

stat_label

(formula-list-selector)
a named list, a list of formulas, or a single formula where the list element is either a named list or a list of formulas defining the statistic labels, e.g. everything() ~ list(mean = "Mean", sd = "SD") or everything() ~ list(mean ~ "Mean", sd ~ "SD").

...

These dots are for future extensions and must be empty.

Value

an ARD data frame of class 'card'

statistic argument

The following statistics are available: 'mean', 'median', 'min', 'max', 'sum', 'var', 'sd', 'mean.std.error', 'deff', 'p##', where 'p##' is are the percentiles and ⁠##⁠ is an integer between 0 and 100.

Examples


data(api, package = "survey")
dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc)

ard_continuous(
  data = dclus1,
  variables = api00,
  by = stype
)


cardx documentation built on Sept. 11, 2024, 9:12 p.m.