NHS numbers are 10 digit numbers where the 10th digit is a checksum. This function validates the checksums of the supplied NHS numbers.
is_valid(nhs_number, warn = TRUE)
A vector of 10 digit NHS numbers to validate
Boolean that controls display of warning messages
A logical vector indicating the validity of each input value
is_valid(1234567881)
#> [1] TRUE
is_valid(c(1234567881, 1234512345, 123456789))
#> Warning: nhs_number is incorrect length - should be 10 digits
#> [1] TRUE FALSE FALSE
is_valid(1234567890, warn = FALSE)
#> [1] FALSE