oldbailey: Accessing The Old Bailey Historical Criminal Trials

If this project helped, consider supporting it:

Buy Me a Coffee

oldbailey fetches historical trial data from the Old Bailey API (April 13, 1674 - April 1, 1913). It parses and resolves ambiguous and inconsistent XML while adding valuable metadata, such as the name of the first-person speaker. It returns an analysis-ready data frame with fields for:

Note: Not all trials mention the proper names of defendants or victims, or contain first-person speakers.

Optional parameters allow users to specify the number of results, the dates of the trials, and whether they contain key terms.

Install

Install from CRAN: (forthcoming)

install.packages("oldbailey")

Install from the rOpenGov universe:

# Enable repository from ropengov
options(repos = c(
  ropengov = 'https://ropengov.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))
  
# Download and install oldbailey
install.packages("oldbailey")

Return Old Bailey Trials in Two Steps

  1. Use find_trials() to return a list of XML addresses for the trials coresponding to the search parameters. By default, find_trials() will return the addresses for all 197,752 trials.
xml_addresses <- find_trials() 
  1. Pass the XML addresses to parse_trials() to return an analysis-ready data frame with the Old Bailey trial data.
trials_df <- parse_trials(xml_addresses)

Examples

Users can choose the number of trials to return.

find_trials(n_results = 200)

Users can also search for trials that contain key terms. This requires the user to supply: a) the term's category; and b) the term itself.

find_trials(cat = "offcat", term = "deception")

Several categories and terms can be provided. Note: this causes the API to return trials that are tagged as BOTH "deception" and "theft." It does not return trials that are tagged just "deception" and just "theft."

find_trials(n_results = 200, cat = c("offcat", "offcat"), term = c("deception", "theft"))

Users can combine both steps in a single line of code.

parse_trials(find_trials(n_results = 15, cat = "offcat", term = "deception"))

Old Bailey only recognizes specific terms in relation to a category. Use old_bailey_api_terms() to see every possible term and its category name.

If you know the category name, you can supply it to old_bailey_api_terms() and see every term that belongs to it. Below is a list of all the categories recongized by Old Bailey:

The following code returns all the terms pertaining to "defgen" (for defendant gender) and "offcat" (for offence category).

old_bailey_api_terms(cat = c("defgen", "offcat"))
# A tibble: 12 × 3
   name   type   terms        
   <chr>  <chr>  <chr>        
 1 defgen select female       
 2 defgen select indeterminate
 3 defgen select male         
 4 offcat select breakingPeace
 5 offcat select damage       
 6 offcat select deception    
 7 offcat select kill         
 8 offcat select miscellaneous
 9 offcat select royalOffences
10 offcat select sexual       
11 offcat select theft        
12 offcat select violentTheft 

Usage

find_trials()

Argument Description
n_results Any positive number. To return all results, keep this empty or pass "all." (optional).
cat Find trials pertaining to a category. (optional).
term Find trials pertaining to a term. (optional).

Note: "cat" and "term" must be specified together. (In otherwords, a category cannot be specified without a term, and vice-versa.)

parse_trials()

Argument Description
xml_address One or more XML addresses.

old_bailey_api_terms()

Argument Description
cat Specify results for one or more categories. (optional).

Parsing Old Bailey XML

The XML parser handles issues with the XML tags while adding valuable metadata to the records. Many XML tags are ambiguous or inconsistent, and tagging conventions change for different periods. XML tags often miss person names, and they don't make a distinction between the names of people speaking and the names of people mentioned by others.

Crime Subcategories

Punishment Subcategories

Citation

Please cite the package as follows:

Buongiorno S (2023). oldbailey: For Accessing The Old Bailey Open Data. https://github.com/stephbuon/oldbailey, https://ropengov.github.io/oldbailey/, https://github.com/rOpenGov/oldbailey.

BibTeX:

@Manual{,
  title = {oldbailey: For Accessing The Old Bailey Open Data.},
  author = {Steph Buongiorno},
  year = {2023},
  note = {https://github.com/stephbuon/oldbailey,
https://ropengov.github.io/oldbailey/, https://github.com/rOpenGov/oldbailey},
}

See my website for more projects.

Disclaimer

This package is not officially related to or endorsed by Old Bailey Online or the Government of the United Kingdom.