A check may be performed for Inadmissible categorical values using con_inadmissible_categorical:

# Load dataquieR
library(dataquieR)

# Load data
sd1 <- prep_get_data_frame("ship")

# Load metadata
file_name <- system.file("extdata", "ship_meta_v2.xlsx", package = "dataquieR")
prep_load_workbook_like_file(file_name)
meta_data_item <- prep_get_data_frame("item_level") # item_level is a sheet in ship_meta_v2.xlsx

# Apply indicator function
IAVCatAll <- con_inadmissible_categorical(
  study_data = sd1, 
  meta_data  = meta_data_item, 
  label_col  = "LABEL"
)

As with inadmissible numerical values, a table output displays the observed categories, the defined categories, any non matching level, its count, and a GRADING:

IAVCatAll$SummaryData
Variables OBSERVED_CATEGORIES DEFINED_CATEGORIES NON_MATCHING NON_MATCHING_N NON_MATCHING_N_PER_CATEGORY GRADING
OBS_SOMA_0 1, 2, 3, 4, 5, 7, 8, 9 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 0 0 0
DEV_HEIGHT_0 3, 4, 11 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 0 0 0
DEV_WEIGHT_0 1, 2, 11 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 0 0 0
OBS_INT_0 1, 2, 3, 4, 5, 7, 10, 11, 12, 13, 22, 23, 25 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 0 0 0
SCHOOL_GRAD_0 0, 1, 2, 3, 4 0, 1, 2, 3 4 7 7 (“4”) 1
RELATION_STATUS_0 1, 2, 3, 4, 5 1, 2, 3, 4, 5 0 0 0
SMOKING_STATUS_0 0, 1, 2 0, 1, 2 0 0 0
STROKE_YN_0 1, 2 1, 2 0 0 0
MYOCARD_YN_0 1, 2 1, 2 0 0 0
DIABETES_KNOWN_0 0, 1 0, 1 0 0 0
CONTRACEPTIVA_EVER_0 1, 2 1, 2 0 0 0
HOUSE_INCOME_MONTH_0 1, 2, 3 1, 2, 3 0 0 0
SEX_0 1, 2 1, 2 0 0 0
OBS_BP_0 1, 3, 4, 5, 7, 8, 9, 11, 16, 18 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 0 0 0
DEV_BP_0 7, 9, 10, 14, 15, 16, 17, 18, 19, 20, 22 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 0 0 0


The results show that there is one variable, SCHOOL_GRAD_0, with one inadmissible level occurring.

Back to Example data quality assessment of SHIP data