Skip to contents

Get the median for a numeric var

Usage

kobo_median(
  design,
  vars,
  survey,
  group = NULL,
  group_key_sep = " -/- ",
  label_survey = TRUE,
  na_rm = TRUE,
  vartype = "ci",
  level = 0.95
)

Arguments

design

A srvyr::design object.

vars

Variables to calculate median from.

survey

The survey sheet from Kobo (with column "type" split). See impactR.kobo::split_survey().

group

A quoted vector of columns to group by. Default to NULL for no group.

group_key_sep

A character string to separate grouping column names in a fancy 'group_key' column.

label_survey

Boolean. Retrieve var's label from the survey sheet? Default to TRUE.

na_rm

Should NAs from var be removed? Default to TRUE.

vartype

NULL to report no variability. Otherwise one or more of: standard error ("se", the default), confidence interval ("ci"), variance ("var") or coefficient of variation ("cv").

level

A single number indicating the confidence level (only one level allowed). Note that this may effect estimated standard errors (see svyquantile details on alpha, which equals 1-level).

Value

A character vector of select_one questions.

Details

survey should have a split type column with types of variables such as "select_one", "select_multiple", etc.