util_study_var2factor: Convert a study variable to a factor

View source: R/util_study_var2factor.R

util_study_var2factorR Documentation

Convert a study variable to a factor

Description

Convert a study variable to a factor

Usage

util_study_var2factor(
  resp_vars = NULL,
  study_data,
  meta_data = "item_level",
  label_col = LABEL,
  assume_consistent_codes = TRUE,
  have_cause_label_df = FALSE,
  code_name = c(JUMP_LIST, MISSING_LIST),
  include_sysmiss = TRUE
)

Arguments

resp_vars

variable list the name of the measurement variables

study_data

data.frame the data frame that contains the measurements

meta_data

data.frame the data frame that contains metadata attributes of study data

label_col

variable attribute the name of the column in the metadata with labels of variables

assume_consistent_codes

logical assume, that missing codes are consistent for all variables

have_cause_label_df

logical is a missing-code table available

code_name

character all lists from the meta_data to use for the coding.

include_sysmiss

logical add also a factor level for data values that were NA in the original study data (system missingness).

Value

study_data converted to factors using the coding provided in code_name


dataquieR documentation built on July 26, 2023, 6:10 p.m.