Skip to content

Commit

Permalink
export link_apt and fix bug (#41)
Browse files Browse the repository at this point in the history
in some cases, address stubs with street names would be parsed as city
names;
the NULL street name pulled out of the address components caused
an error when trying to match NULL with the known apartment
street names
  • Loading branch information
cole-brokamp committed Dec 22, 2023
1 parent e28d27e commit dc6cf75
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: parcel
Title: Convert real-world street addresses to county parcel identifiers
Version: 0.10.0
Version: 0.10.1
Authors@R:
person("Cole", "Brokamp", , "cole@colebrokamp.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0289-3151"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export("%as%")
export(clean_address)
export(create_address_stub)
export(get_parcel_data)
export(link_apt)
export(link_parcel)
export(tag_address)
importFrom(reticulate,"%as%")
3 changes: 2 additions & 1 deletion R/link_apt.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#'
#' @param x a single address character string
#' @return apt pseudo-identifier character string; `NA` if not matched
#' @export
link_apt <- function(x) {
x_tags <- tag_address(x)
if (!x_tags$zip_code %in% cincy::zcta_tigris_2020$zcta_2020) {
return(NA)
}
apt_id <-
purrr::map(apt_defs, purrr::pluck, "street_name") |>
purrr::map_lgl(\(x) x_tags[["street_name"]] %in% x) |>
purrr::map_lgl(\(x) purrr::pluck(x_tags, "street_name", .default = NA) %in% x) |>
which() |>
names()
if (length(apt_id) == 0) {
Expand Down

0 comments on commit dc6cf75

Please sign in to comment.