Methods implemented for
character: will be cleaned (ifclean = TRUE) withclean_address_text()and then tagged usingusaddress_tag(); tags are normalized to abbreviations by passing allmap_*arguments toaddr_street()oraddr_place(); ZIP codes parsed with more than five characters are truncated with a warning, and malformed parsed ZIP codes are set to missing with a warning; non-numeric characters in parsed address number digits will be removed with a warning; parsed address number digits greater than 999999 are truncated to the first six digits with a warningdata.frame: must have columns named according to fields inaddr_number(),addr_street(), oraddr_place(); also passes themap_*arguments toaddr_street()andaddr_place()addr: returned as-is when already uppercase; legacy mixed-case objects are reconstructed in the current uppercase canonical form
Legacy addr vectors loaded from user-owned serialized files can be upgraded
explicitly with as_addr(readRDS(...)). The user-owned file is not rewritten
automatically.
Examples
as_addr(voter_addresses()[1:25])
#> <addr>
#> @ number: <addr_number> function ()
#> .. @ prefix: chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> .. @ digits: chr [1:25] "3359" "1040" "9960" "413" "8519" "6361" "10466" ...
#> .. @ suffix: chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> @ street: <addr_street> function ()
#> .. @ predirectional : chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> .. @ premodifier : chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> .. @ pretype : chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> .. @ name : chr [1:25] "QUEEN CITY" "KREIS" "DALY" "VOLKERT" "LINDERWOOD" ...
#> .. @ posttype : chr [1:25] "AVE" "LN" "RD" "PL" "LN" "AVE" "LN" "CIR" "AVE" ...
#> .. @ postdirectional: chr [1:25] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ...
#> @ place : <addr_place> function ()
#> .. @ name : chr [1:25] "CINCINNATI" "CINCINNATI" "CINCINNATI" "CINCINNATI" ...
#> .. @ state : chr [1:25] "OH" "OH" "OH" "OH" "OH" "OH" "OH" "OH" "OH" "OH" ...
#> .. @ zipcode: chr [1:25] "45238" "45205" "45231" "45219" "45255" "45230" ...
data.frame(
number_digits = c("290", "200"),
street_name = c("Burnet", "Main"),
street_posttype = c("Ave", "St"),
place_name = c("Cincinnati", "Cincinnati"),
place_state = c("OH", "OH"),
place_zipcode = c("45229", "45220"),
stringsAsFactors = FALSE
)|>
as_addr()
#> <addr>
#> @ number: <addr_number> function ()
#> .. @ prefix: chr [1:2] "" ""
#> .. @ digits: chr [1:2] "290" "200"
#> .. @ suffix: chr [1:2] "" ""
#> @ street: <addr_street> function ()
#> .. @ predirectional : chr [1:2] "" ""
#> .. @ premodifier : chr [1:2] "" ""
#> .. @ pretype : chr [1:2] "" ""
#> .. @ name : chr [1:2] "BURNET" "MAIN"
#> .. @ posttype : chr [1:2] "AVE" "ST"
#> .. @ postdirectional: chr [1:2] "" ""
#> @ place : <addr_place> function ()
#> .. @ name : chr [1:2] "CINCINNATI" "CINCINNATI"
#> .. @ state : chr [1:2] "OH" "OH"
#> .. @ zipcode: chr [1:2] "45229" "45220"