zip_codes <- c(
"90210",
"20500",
"22313-1450", #5+4 style ok
"223131450", #fails, no hyphen
"09901" #fails, invalid area prefix
)
is_us_zip_code(zip_codes)
assert_any_are_us_zip_codes(zip_codes)
#The following code should throw an error.
assert_all_are_us_zip_codes(zip_codes)
Run the code above in your browser using DataLab