load(system.file("extdata", "study_data.RData", package = "dataquieR"))
sd1 <- study_data
The study data with N = 3000 observations and P = 53 variables have been loaded.
load(system.file("extdata", "meta_data.RData", package = "dataquieR"))
md1 <- meta_data
The metadata with K = 53 rows related to variables and M = 23 static attributes have been loaded.
The call of this R-function requires two inputs only. However, if a
LABEL column is present in the metadata it is recommended to
use these in case VAR_NAMES are not self-explanatory. You can
give resp_vars
to restrict the checks to a given set of
study variables. You can allow a number of failing conversions without
the cell becoming red by setting threshold_value
to the
percentage of failing conversions allowed.
This function only compares the data types of the study data with the declared types from the metadata, so far.
sd1$v00000[5] <- "1,5" # introduce some conversions problem.
sd1$v00003 <- as.character(sd1$v00003) # introduce a problem, than can be fixed
integritymatrix <- int_datatype_matrix(study_data = sd1, meta_data = md1, label_col = LABEL)
Heatmap-like plot:
integritymatrix$SummaryPlot
If the formal threshold_value
allows 1% unconvertible
mismatches, the one non-convertible entry, the error disappears.
integritymatrix <- int_datatype_matrix(study_data = sd1, meta_data = md1, label_col = LABEL, threshold_value = 1)
Heatmap-like plot:
integritymatrix$SummaryPlot
If KEY_STUDY_SEGMENT is defined for all variables, another formal can be used to split the plot.
integritymatrix <- int_datatype_matrix(study_data = sd1, meta_data = md1, label_col = LABEL,
split_segments = TRUE)
## Did not find any 'SCALE_LEVEL' column in item-level meta_data. Predicting it from the data -- please verify these predictions, they may be wrong and lead to functions claiming not to be reasonably applicable to a variable.
## Data type transformation of "v00000" introduced 1 additional missing values.
integritymatrix$DataTypePlotList
## $PART_INTERVIEW
##
## $PART_LAB
##
## $PART_PHYS_EXAM
##
## $PART_QUESTIONNAIRE
##
## $PART_STUDY