element_validation {heims} | R Documentation |
Validate HEIMS elements
Description
Return TRUE or FALSE on whether or not each variable in a data.table complies with the HEIMS code limits
Usage
validate_elements(DT, .progress_cat = FALSE)
prop_elements_valid(DT, char = FALSE)
count_elements_invalid(DT, char = FALSE)
Arguments
DT |
The data.table whose variables are to be validated. |
.progress_cat |
Should the progress of the function be displayed on the console? If |
char |
Return as character vector, in particular marking – any complete or completely absent values. |
Details
For early detection of invalid results, the type of the variable (in particular integer vs double) is considered first,
vetoing a TRUE
result if different.
Value
A named logical vector, whether or not the variable complies with the style requirements. A value of NA
indicates the variable
was not checked (perhaps because it is absent from heims_data_dict
).
Examples
X <- data.frame(E306 = c(0, 1011, 999, 9998))
validate_elements(X) # FALSE
prop_elements_valid(X)
X <- data.frame(E306 = as.integer(c(0, 1011, 999, 9998)))
validate_elements(X) # TRUE
[Package heims version 0.4.0 Index]