check_ct_data {metatools} | R Documentation |
Check Control Terminology for a Dataset
Description
This function checks that all columns in the dataset only contains the control terminology as defined by the metacore specification
Usage
check_ct_data(data, metacore, na_acceptable = NULL, omit_vars = NULL)
Arguments
data |
Dataset to check |
metacore |
metacore object that contains the specifications for the
dataset of interest. If any variable has different codelists for different
datasets the metacore object will need to be subsetted using
|
na_acceptable |
|
omit_vars |
|
Value
Given data if all columns pass. It will error otherwise
Examples
library(haven)
library(metacore)
library(magrittr)
load(metacore_example("pilot_ADaM.rda"))
spec <- metacore %>% select_dataset("ADSL", quiet = TRUE)
data <- read_xpt(metatools_example("adsl.xpt"))
check_ct_data(data, spec, omit_vars = c("AGEGR2", "AGEGR2N"))
## Not run:
# These examples produce errors:
check_ct_data(data, spec, na_acceptable = FALSE)
check_ct_data(data, spec, na_acceptable = FALSE, omit_vars = "DISCONFL")
check_ct_data(data, spec, na_acceptable = c("DSRAEFL", "DCSREAS"), omit_vars = "DISCONFL")
## End(Not run)