Package 'nhsnumber'

Title: Tools for Working with NHS Number Checksums
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.
Authors: Mark Sellors [aut, cre, cph]
Maintainer: Mark Sellors <[email protected]>
License: MIT + file LICENSE
Version: 0.1.2
Built: 2024-10-16 02:45:03 UTC
Source: https://github.com/sellorm/nhsnumber

Help Index


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)