diff --git a/R/atom_ad_db.R b/R/atom_ad_db.R index 3dbc18f..6ae94d6 100644 --- a/R/atom_ad_db.R +++ b/R/atom_ad_db.R @@ -89,7 +89,11 @@ catr_atom_get_address_db_to <- function(to, all <- catr_atom_get_address_db_all() alldist <- unique(all[, c("territorial_office", "url")]) - findto <- grep(to, alldist$territorial_office, ignore.case = TRUE)[1] + # Escape parenthesis + to <- gsub("\\(|\\)", "", to) + allto <- gsub("\\(|\\)", "", alldist$territorial_office) + + findto <- grep(to, allto, ignore.case = TRUE)[1] if (is.na(findto)) { message("No Territorial office found for ", to) diff --git a/R/atom_bu_db.R b/R/atom_bu_db.R index 7e41784..ef431d2 100644 --- a/R/atom_bu_db.R +++ b/R/atom_bu_db.R @@ -88,7 +88,11 @@ catr_atom_get_buildings_db_to <- function(to, all <- catr_atom_get_buildings_db_all() alldist <- unique(all[, c("territorial_office", "url")]) - findto <- grep(to, alldist$territorial_office, ignore.case = TRUE)[1] + # Escape parenthesis + to <- gsub("\\(|\\)", "", to) + allto <- gsub("\\(|\\)", "", alldist$territorial_office) + + findto <- grep(to, allto, ignore.case = TRUE)[1] if (is.na(findto)) { message("No Territorial office found for ", to) diff --git a/R/atom_cp_db.R b/R/atom_cp_db.R index c9f875a..eaba270 100644 --- a/R/atom_cp_db.R +++ b/R/atom_cp_db.R @@ -88,7 +88,11 @@ catr_atom_get_parcels_db_to <- function(to, all <- catr_atom_get_parcels_db_all() alldist <- unique(all[, c("territorial_office", "url")]) - findto <- grep(to, alldist$territorial_office, ignore.case = TRUE)[1] + # Escape parenthesis + to <- gsub("\\(|\\)", "", to) + allto <- gsub("\\(|\\)", "", alldist$territorial_office) + + findto <- grep(to, allto, ignore.case = TRUE)[1] if (is.na(findto)) { message("No Territorial office found for ", to) diff --git a/R/utils_atom.R b/R/utils_atom.R index 4847af6..837d107 100644 --- a/R/utils_atom.R +++ b/R/utils_atom.R @@ -31,9 +31,9 @@ catr_read_atom <- function(file, top = TRUE, encoding = "UTF-8") { tbl <- tibble::tibble( - title = title, - url = url, - value = value, + title = trimws(title), + url = trimws(url), + value = trimws(value), date = date ) @@ -46,8 +46,8 @@ catr_read_atom <- function(file, top = TRUE, encoding = "UTF-8") { date <- as.POSIXct(unlist(feed[1]$entry$updated)) tbl <- tibble::tibble( - title = title, - url = url, + title = trimws(title), + url = trimws(url), date = date )