When you give format_postcode some non-NA invalid postcodes it prints out a warning. This is usually fine, but I have a use case where we are using it to format postcodes but also remove any invalid ones (we have a lot of crap in the data). I think this isn't a particularly unusual use case? It's annoying that I get a big warning message, and the only workaround for me is to wrap it in suppressWarnings()
Current:
dplyr::mutate(
dplyr::across(contains("postcode"), phsmethods::format_postcode)
)
Warning message:
Problem while computing `..1 = dplyr::across(contains("postcode"),
phsmethods::format_postcode)`.
ℹ 19 non-NA input values do not adhere to the standard UK postcode format
(with or without spaces) and will be coded as NA. The standard format is:
• 1 or 2 letters, followed by
• 1 number, followed by
• 1 optional letter or number, followed by
• 1 number, followed by • 2 letters
When you give
format_postcode
some non-NA invalid postcodes it prints out a warning. This is usually fine, but I have a use case where we are using it to format postcodes but also remove any invalid ones (we have a lot of crap in the data). I think this isn't a particularly unusual use case? It's annoying that I get a big warning message, and the only workaround for me is to wrap it insuppressWarnings()
Current:
Workaround:
Ideal solution: