Title: | For Accessing the Old Bailey Open Data |
---|---|
Description: | Fetch trial data from the Old Bailey Online API <https://www.oldbaileyonline.org/static/DocAPI.jsp>. Data is returned in an analysis-ready data frame with fields for metadata including (but not limited to) the names of the first person speakers, defendants, victims, their recorded genders, verdicts, punishments, crime locations, and dates. Optional parameters allow users to specify the number of results, whether these results contain key terms, and trial dates. |
Authors: | Steph Buongiorno [aut, cre] |
Maintainer: | Steph Buongiorno <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-10-29 03:15:26 UTC |
Source: | https://github.com/rOpenGov/oldbailey |
For finding Old Bailey trial data.
find_trials( n_results = "all", cat = NA, term = NA )
find_trials( n_results = "all", cat = NA, term = NA )
n_results |
The number of results to return. By default, all results are returned. |
cat |
Find trials pertaining to a category. (optional). |
term |
Find trials pertaining to a term. (optional). |
Dataframe containing API pull of XML addresses for Old Bailey Trials corresponding with the search criteria.
# Return a dataframe with 5 trials. trials <- find_trials(n_results = 5) head(trials) # Return a dataframe with 5 trials on deception. trials <- find_trials(n_results = 5, cat = "offcat", term = "deception") head(trials)
# Return a dataframe with 5 trials. trials <- find_trials(n_results = 5) head(trials) # Return a dataframe with 5 trials on deception. trials <- find_trials(n_results = 5, cat = "offcat", term = "deception") head(trials)
For viewing terms and their categories.
old_bailey_api_terms( cat = NULL )
old_bailey_api_terms( cat = NULL )
cat |
Return terms corresponding to a category of crime. By default, all terms and categories are returned. |
Dataframe containing API pull of terms and their categories.
# Return a dataframe with the terms corresponding to defendant gender or offensive category. terms <- old_bailey_api_terms(cat = c("defgen", "offcat")) head(terms)
# Return a dataframe with the terms corresponding to defendant gender or offensive category. terms <- old_bailey_api_terms(cat = c("defgen", "offcat")) head(terms)
For parsing Old Bailey trial data.
parse_trials( xml_address )
parse_trials( xml_address )
xml_address |
One or more XML addresses. A single XML address can be passed as a string, or numerous XML addresses can be passed as a list. |
Dataframe containing API pull of parsed Old Bailey Trials.
# Return a dataframe with parsed trial data. xml_address <- "https://www.oldbaileyonline.org/obapi/text?div=t17690112-9" parsed_trial <- parse_trials(xml_address) head(parsed_trial)
# Return a dataframe with parsed trial data. xml_address <- "https://www.oldbaileyonline.org/obapi/text?div=t17690112-9" parsed_trial <- parse_trials(xml_address) head(parsed_trial)