Sabre is a toolbox to ease and standardize the cleaning of business and address records.
devtools::install_github("FoodStandardsAgency/sabre")
Not available just yet. You can install the released version of sabre from CRAN with:
r install.packages("sabre")
Replace special characters in strings and melt columns on separators.
|postcode |trading_name | |:--------|:-------------------------------------------| |B42 1AB |Cosy café @ The horse and hound | |B25 |Food Zone t/a ReFood | |G12 0ZS |Hocus Pocus t/aVan Leer | |SE16 1BE |Media Luna Bakery Ltd trading as Media Luna | |EC2M 1AA |t/a Pharmacy Doherty |
library(sabre)
melt_rows(
businesses[4:8, 3:4],
"trading_name",
dividers = c("\\|", " trading as ", "t/a", "\\/")
) %>%
dplyr::mutate_at(., "trading_name", ~replace_in_string(., "@", "")) %>%
dplyr::mutate_at(., "trading_name", strip_business_legal_entity_type) %>%
dplyr::mutate_at(., "trading_name", stringr::str_squish)
|postcode |trading_name | |:--------|:-----------------------------| |B42 1AB |Cosy café The horse and hound | |B25 |Food Zone | |B25 |ReFood | |G12 0ZS |Hocus Pocus | |G12 0ZS |Van Leer | |SE16 1BE |Media Luna Bakery | |SE16 1BE |Media Luna | |EC2M 1AA |Pharmacy Doherty |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.