In the block below, we should see a message if the metadata doesn't match the data. However, if the number of unique values in data does not match the number of enumeration codes, we get an unhandled error instead.
if (!all(unique(entity_df[[i]]) %in% c(cats, codes) | c(cats, codes) %in% unique(entity_df[[i]]))) {
msg <- paste(
"Enumeration in attribute",
i,
"in metadata not matching that in data for entity",
entity_name
)
output_msgs <- c(output_msgs, msg)
}
The error reads:
longer object length is not a multiple of shorter object length
To handle the error, we should first check the lengths. Whether there's a length mismatch or some other mismatch, we should also at least report which attribute and table we were checking.
In the block below, we should see a message if the metadata doesn't match the data. However, if the number of unique values in data does not match the number of enumeration codes, we get an unhandled error instead.
The error reads:
To handle the error, we should first check the lengths. Whether there's a length mismatch or some other mismatch, we should also at least report which attribute and table we were checking.