combine_match_general_to_trades {podcleaner}R Documentation

Match general to trades directory records

Description

Attempts to complement Scottish post office trades directory data.frame with house address information from the Scottish post office general directory data.frame provided by matching records from the two datasets using the distance metric specified.

Usage

combine_match_general_to_trades(
  trades_directory,
  general_directory,
  progress = TRUE,
  verbose = FALSE,
  distance = TRUE,
  matches = TRUE,
  ...
)

Arguments

trades_directory

A Scottish post office trades directory in the form of a data.frame or other object that inherits from the data.frame class such as a tibble. Columns must at least include surname, forename, address.trade.number, address.trade.body.

general_directory

A Scottish post office general directory in the form of a data.frame or other object that inherits from the data.frame class such as a tibble. Columns must at least include surname, forename, address.trade.number, address.trade.body, address.house.number, address.house.body.

progress

Whether progress should be shown (TRUE) or not (FALSE).

verbose

Whether the function should be executed silently (FALSE) or not (TRUE).

distance

Whether (TRUE) or not (FALSE) a column 'distance' showing the string distance between records used for their matching and calculated using the method specified below should be added to the output dataset.

matches

Whether (TRUE) or not (FALSE) a column 'match' showing general directory matches' name and address(es) should be added to the output dataset.

...

Further arguments to be passed down to stringdist_left_join.

Value

A tibble; columns include at least surname, forename, address.trade.number, address.trade.body, address.house.number, address.house.body.

Examples

trades_directory <- tibble::tibble(
  page = rep("71", 3L),
  rank = c("135", "326", "586"),
  surname = c("Abbott", "Abercromby", "Blair"),
  forename = c("William", "Alexander", "John Hugh"),
  occupation = c("Wine and spirit merchant", "Baker", "Victualler"),
  type = rep("OWN ACCOUNT", 3L),
  address.trade.number = c("18, 20", "12", "280"),
  address.trade.body = c("London Road", "Dixon Place", "High Street")
)
general_directory <- tibble::tibble(
  page = rep("71", 2L),
  surname = c("Abbott", "Abercromby"), forename = c("William", "Alexander"),
  occupation = c("Wine and spirit merchant", "Baker"),
  address.trade.number = c("18, 20", ""),
  address.house.number = c("136", "29"),
  address.trade.body = c("London Road", "Dixon Place"),
  address.house.body = c("Queen Square", "Anderston Quay")
)
combine_match_general_to_trades(
 trades_directory, general_directory, progress = TRUE, verbose = FALSE,
 distance = TRUE, method = "osa", max_dist = 5
)


[Package podcleaner version 0.1.2 Index]