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

See Also

Other data_management: util_assign_levlabs(), util_check_data_type(), util_check_group_levels(), util_compare_meta_with_study(), util_dichotomize(), util_merge_data_frame_list(), util_rbind(), util_remove_na_records(), util_replace_hard_limit_violations(), util_table_of_vct()


dataquieR documentation built on May 29, 2024, 7:18 a.m.