util_int_unexp_records_set_segment: Check for unexpected data record set

View source: R/util_int_unexp_records_set_segment.R

util_int_unexp_records_set_segmentR Documentation

Check for unexpected data record set

Description

This function tests that the identifiers match a provided record set. It is possible to check for unexpected data record sets by study segments or to consider only selected segments.

Usage

util_int_unexp_records_set_segment(
  level = c("segment"),
  id_vars_list,
  identifier_name_list,
  valid_id_table_list,
  meta_data_record_check_list,
  study_data,
  meta_data
)

Arguments

level

character a character vector indicating whether the assessment should be conducted at the study level (level = "dataframe") or at the segment level (level = "segment").

id_vars_list

list the list containing the identifier variables names to be used in the assessment.

identifier_name_list

list the list that contains the name of the identifier to be used in the assessment. For the study level, corresponds to the names of the different data frames. For the segment level, indicates the name of the segments.

valid_id_table_list

list the reference list with the identifier variable values.

meta_data_record_check_list

character a character vector indicating the type of check to conduct, either "subset" or "exact".

study_data

data.frame the data frame that contains the measurements, mandatory.

meta_data

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

Value

a list with

  • SegmentData: data frame with the results of the quality check for unexpected data elements

  • SegmentTable: data frame with selected unexpected data elements check results, used for the data quality report.

  • UnexpectedRecords: vector with row indices of duplicated records, if any, otherwise NULL.

Examples

## Not run: 
study_data <- readRDS(system.file("extdata", "ship.RDS",
  package = "dataquieR"
))
meta_data <- readRDS(system.file("extdata", "ship_meta.RDS",
  package = "dataquieR"
))
md1_segment <- readRDS(system.file("extdata", "meta_data_segment.RDS",
  package = "dataquieR"
))
ids_segment <- readRDS(system.file("extdata", "meta_data_ids_segment.RDS",
  package = "dataquieR"
))

# TODO: update examples
int_unexp_records_set(
  level = "segment",
  identifier_name_list = c("INTERVIEW", "LABORATORY"),
  valid_id_table_list = ids_segment,
  meta_data_record_check = md1_segment[,
    c("STUDY_SEGMENT", "SEGMENT_RECORD_CHECK")],
  study_data = study_data,
  meta_data = meta_data
)

## End(Not run)

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