int_datatype_matrix: Check declared data types of metadata in study data

View source: R/int_datatype_matrix.R

int_datatype_matrixR Documentation

Check declared data types of metadata in study data

Description

Checks data types of the study data and for the data type declared in the metadata

Indicator

Usage

int_datatype_matrix(
  resp_vars = NULL,
  study_data,
  meta_data,
  split_segments = FALSE,
  label_col,
  max_vars_per_plot = 20,
  threshold_value = 0
)

Arguments

resp_vars

variable the names of the measurement variables, if missing or NULL, all variables will be checked

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

split_segments

logical return one matrix per study segment

label_col

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

max_vars_per_plot

integer from=0. The maximum number of variables per single plot.

threshold_value

numeric from=0 to=100. percentage failing conversions allowed to still classify a study variable convertible. inheritParams acc_distributions

Details

This is a preparatory support function that compares study data with associated metadata. A prerequisite of this function is that the no. of columns in the study data complies with the no. of rows in the metadata.

For each study variable, the function searches for its data type declared in static metadata and returns a heatmap like matrix indicating data type mismatches in the study data.

List function.

Value

a list with:

  • SummaryTable: data frame about the applicability of each indicator function (each function in a column). its integer values can be one of the following four categories: 0. Non-matching datatype, 1. Matching datatype,

  • SummaryPlot: ggplot2 heatmap plot, graphical representation of SummaryTable

  • DataTypePlotList: list of plots per (maybe artificial) segment

  • ReportSummaryTable: data frame underlying SummaryPlot

Examples

## Not run: 
load(system.file("extdata/meta_data.RData", package = "dataquieR"), envir =
  environment())
load(system.file("extdata/study_data.RData", package = "dataquieR"), envir =
  environment())
study_data$v00000 <- as.character(study_data$v00000)
study_data$v00002 <- as.character(study_data$v00002)
study_data$v00002[3] <- ""
appmatrix <- int_datatype_matrix(study_data = study_data,
                                 meta_data = meta_data,
                                 label_col = LABEL)
study_data$v00002[5] <- "X"
appmatrix <- int_datatype_matrix(study_data = study_data,
                                 meta_data = meta_data,
                                 label_col = LABEL)
appmatrix$ReportSummaryTable

## End(Not run)

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