con_limit_deviations: Detects variable values exceeding limits defined in metadata

View source: R/con_limit_deviations.R

con_limit_deviationsR Documentation

Detects variable values exceeding limits defined in metadata

Description

Inadmissible numerical values can be of type integer or float. This implementation requires the definition of intervals in the metadata to examine the admissibility of numerical study data.

This helps identify inadmissible measurements according to hard limits (for multiple variables).

Indicator

Usage

con_limit_deviations(
  resp_vars = NULL,
  study_data,
  label_col,
  item_level = "item_level",
  meta_data_cross_item = "cross-item_level",
  limits = NULL,
  flip_mode = "noflip",
  return_flagged_study_data = FALSE,
  return_limit_categorical = TRUE,
  meta_data = item_level,
  cross_item_level,
  `cross-item_level`,
  meta_data_v2,
  show_obs = TRUE
)

Arguments

resp_vars

variable list the name of the measurement variables

study_data

data.frame the data frame that contains the measurements

label_col

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

item_level

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

meta_data_cross_item

meta_data_cross

limits

enum HARD_LIMITS | SOFT_LIMITS | DETECTION_LIMITS. what limits from metadata to check for

flip_mode

enum default | flip | noflip | auto. Should the plot be in default orientation, flipped, not flipped or auto-flipped. Not all options are always supported. In general, this con be controlled by setting the roptions(dataquieR.flip_mode = ...). If called from dq_report, you can also pass flip_mode to all function calls or set them specifically using specific_args.

return_flagged_study_data

logical return FlaggedStudyData in the result

return_limit_categorical

logical if TRUE return limit deviations also for categorical variables

meta_data

data.frame old name for item_level

cross_item_level

data.frame alias for meta_data_cross_item

meta_data_v2

character path to workbook like metadata file, see prep_load_workbook_like_file for details. ALL LOADED DATAFRAMES WILL BE PURGED, using prep_purge_data_frame_cache, if you specify meta_data_v2.

show_obs

logical Should (selected) individual observations be marked in the figure for continuous variables?

`cross-item_level`

data.frame alias for meta_data_cross_item

Details

Algorithm of this implementation:

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

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

  • Identification of measurements outside defined limits. Therefore two output data frames are generated:

    • on the level of observation to flag each deviation, and

    • a summary table for each variable.

  • A list of plots is generated for each variable examined for limit deviations. The histogram-like plots indicate respective limits as well as deviations.

  • Values exceeding limits are removed in a data frame of modified study data

Value

a list with:

  • FlaggedStudyData data.frame related to the study data by a 1:1 relationship, i.e. for each observation is checked whether the value is below or above the limits. Optional, see return_flagged_study_data.

  • SummaryTable data.frame summarizing limit deviations for each variable.

  • SummaryData data.frame summarizing limit deviations for each variable for a report.

  • SummaryPlotList list of ggplot2::ggplots The plots for each variable are either a histogram (continuous) or a barplot (discrete).

  • ReportSummaryTable: heatmap-like data frame about limit violations

See Also


dataquieR documentation built on Jan. 8, 2026, 5:08 p.m.