assertive.data.us (version 0.0-2)

assert_all_are_us_social_security_numbers: Is the string a valid US SSN?

Description

Checks that the input contains US Social Security Number.

Usage

assert_all_are_us_social_security_numbers(x, na_ignore = FALSE,
  severity = getOption("assertive.severity", "stop"))

assert_any_are_us_social_security_numbers(x, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))

is_us_social_security_number(x)

Arguments

x

Input to check.

na_ignore

A logical value. If FALSE, NA values cause an error; otherwise they do not. Like na.rm in many stats package functions, except that the position of the failing values does not change.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

Value

is_us_social_security_number returns TRUE if the input string contains a valid US Social Security Number. The assert_* functions return nothing but throw an error when the is_* function returns FALSE.

Examples

Run this code
# NOT RUN {
ssns <- c("123-45-6789", "666-45-6789", "123-00-6789")
is_us_social_security_number(ssns)
# }

Run the code above in your browser using DataLab