README.md

sabre

License: GPL v3 Travis build status Codecov test coverage R build status stability-unstable Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Binder

Sabre is a toolbox to ease and standardize the cleaning of business and address records.

Installation

Github install

devtools::install_github("FoodStandardsAgency/sabre")

CRAN install

Not available just yet. You can install the released version of sabre from CRAN with: r install.packages("sabre")

Example

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 |



xavier-gilbert/sabre documentation built on May 7, 2021, 12:40 p.m.