stats: stats

View source: R/stats.R

statsR Documentation

stats

Description

Calculates stats (mean, median, total and quantiles) and its variance from ELSOC considering complex survey design

Usage

stats(
  .data,
  x,
  by = NULL,
  stat = c("mean", "median", "total", "quantile"),
  vartype = c("se", "ci", "var", "cv"),
  quantiles = NULL,
  na.rm = FALSE
)

Arguments

.data

Data frame or tbl_svy survey object object

x

Variable or variable name to calculate estimates

by

Vector of variables to group estimates

stat

Type of estimate to calculate. One of: 'mean', 'median', 'total' or 'quantile'

vartype

Report variability as one or more of: standard error ('se', default), confidence interval ('ci'), variance ('var') or coefficient of variation ('cv'). vartype = NULL for no variability

na.rmA

logical value to indicate whether missing values of x should be dropped

Examples

elsoc_example %>% stat(m0_sexo, by = ola, stat = 'mean')
elsoc_example %>% stat(c01, by = c(ola, m0_sexo), stat = 'median')


edgardo-cerda/elsoc documentation built on April 14, 2022, 5:36 p.m.