Type: | Package |
Title: | Tools for Working with NHS Number Checksums |
Version: | 0.1.2 |
Description: | Provides functions for working with NHS number checksums. The UK's National Health Service issues NHS numbers to all users of its services and this package implements functions for verifying that the numbers are valid according to the checksum scheme the NHS use. Numbers can be validated and checksums created. |
URL: | https://github.com/sellorm/nhsnumber |
BugReports: | https://github.com/sellorm/nhsnumber/issues |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.2 |
Suggests: | testthat (≥ 2.1.0) |
NeedsCompilation: | no |
Packaged: | 2021-12-06 15:44:32 UTC; sellorm |
Author: | Mark Sellors [aut, cre, cph] |
Maintainer: | Mark Sellors <rstats@5vcc.com> |
Repository: | CRAN |
Date/Publication: | 2021-12-06 22:20:05 UTC |
Calculates NHS number checksums
Description
NHS numbers are 10 digit numbers where the 10th digit is a checksum. This function takes the 9 core digits of the NHS number and calculates the checksums.
Usage
get_checksum(nhs_number, full_output = FALSE)
Arguments
nhs_number |
A 9 digit NHS numbers to validate |
full_output |
Boolean that controls display of warning messages |
Details
This function has been created using information from: https://en.wikipedia.org/wiki/NHS_number and various NHS sources
Value
Checksum or the complete NHS number including the checksum.
Examples
get_checksum(123456788)
get_checksum(123456788, full_output = TRUE)
Checks validity of an NHS number
Description
NHS numbers are 10 digit numbers where the 10th digit is a checksum. This function validates the checksums of the supplied NHS numbers.
Usage
is_number_valid(nhs_number, warn = TRUE)
Arguments
nhs_number |
A 10 digit NHS number to validate |
warn |
Boolean that controls display of warning messages |
Examples
is_valid(1234567881)
is_valid(1234567890, warn = FALSE)
Checks validity of NHS numbers
Description
NHS numbers are 10 digit numbers where the 10th digit is a checksum. This function validates the checksums of the supplied NHS numbers.
Usage
is_valid(nhs_number, warn = TRUE)
Arguments
nhs_number |
A vector of 10 digit NHS numbers to validate |
warn |
Boolean that controls display of warning messages |
Value
A logical vector indicating the validity of each input value
Examples
is_valid(1234567881)
is_valid(c(1234567881, 1234512345, 123456789))
is_valid(1234567890, warn = FALSE)