Skip to contents

Get the mean for a numeric var

Usage

kobo_mean(
  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 mean 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

Report variability as one or more of: standard error ("se", default), confidence interval ("ci"), variance ("var") or coefficient of variation ("cv").

level

(For vartype = "ci" only) A single number or vector of numbers indicating the confidence 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.