con_inadmissible_categorical: Detects variable levels not specified in metadata

View source: R/con_inadmissible_categorical.R

con_inadmissible_categoricalR Documentation

Detects variable levels not specified in metadata

Description

For each categorical variable, value lists should be defined in the metadata. This implementation will examine, if all observed levels in the study data are valid.

Indicator

Usage

con_inadmissible_categorical(
  resp_vars = NULL,
  study_data,
  meta_data,
  label_col,
  threshold_value = 0
)

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

threshold_value

numeric from=0 to=100. a numerical value ranging from 0-100.

Details

Algorithm of this implementation:

  • Remove missing codes from the study data (if defined in the metadata)

  • Interpretation of variable specific VALUE_LABELS as supplied in the metadata.

  • Identification of measurements not corresponding to the expected categories. Therefore two output data frames are generated:

    • on the level of observation to flag each undefined category, and

    • a summary table for each variable.

  • Values not corresponding to defined categories are removed in a data frame of modified study data

Value

a list with:

  • SummaryData: data frame summarizing inadmissible categories with the columns:

    • Variables: variable name/label

    • OBSERVED_CATEGORIES: the categories observed in the study data

    • DEFINED_CATEGORIES: the categories defined in the metadata

    • NON_MATCHING: the categories observed but not defined

    • NON_MATCHING_N: the number of observations with categories not defined

    • NON_MATCHING_N_PER_CATEGORY: the number of observations for each of the unexpected categories

    • GRADING: indicator TRUE/FALSE if inadmissible categorical values were observed (more than indicated by the threshold_value)

  • SummaryTable: data frame for the dataquieR pipeline reporting the number and percentage of inadmissible categorical values

  • ModifiedStudyData: study data having inadmissible categories removed

  • FlaggedStudyData: study data having cases with inadmissible categories flagged

See Also

Online Documentation


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