element_validation: Validate HEIMS elements

Description Usage Arguments Details Value Examples

Description

Return TRUE or FALSE on whether or not each variable in a data.table complies with the HEIMS code limits

Usage

1
2
3
4
5
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 TRUE the name of the element about to be validated is shown.

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

1
2
3
4
5
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

heims documentation built on May 2, 2019, 9:20 a.m.