Title: For Accessing U.S. Department of Justice (DOJ) Open Data
Version: 1.1.2
Maintainer: Steph Buongiorno <steph.buon@gmail.com>
Depends: R (≥ 3.4.4)
Imports: anytime, dplyr, httr, jsonlite, stringr, tibble
URL: https://github.com/ropengov/usdoj
BugReports: https://github.com/ropengov/usdoj/issues
Description: Fetch data from the https://www.justice.gov/developer/api-documentation/api_v1 API such as press releases, blog entries, and speeches. Optional parameters allow users to specify the number of results starting from the earliest or latest entries, and whether these results contain keywords. Data is cleaned for analysis and returned in a dataframe.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-05-14 14:48:35 UTC; steph
Author: Steph Buongiorno ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2025-05-14 15:00:02 UTC

Retrieve DOJ Blog Entries

Description

This function retrieves blog entries from the U.S. Department of Justice API. You can specify the number of results, sort direction, and an optional keyword filter.

Usage

doj_blog_entries(
  n_results = 50,
  search_direction = "DESC",
  keyword = NULL,
  clean = TRUE
)

Arguments

n_results

Integer. Number of blog entries to retrieve. Default is 50.

search_direction

Character. Sort order: either "ASC" (oldest first) or "DESC" (newest first). Default is "DESC".

keyword

Optional character string to filter results by keyword.

clean

Logical. If TRUE, cleans up the blog body and teaser fields. Default is TRUE.

Value

A cleaned dataframe containing DOJ blog entry metadata and content.

Examples

## Not run: 
# Retrieve a single DOJ blog entry
result <- doj_blog_entries(n_results = 1)
print(result)

## End(Not run)


Retrieve DOJ Press Releases

Description

This function retrieves press releases from the U.S. Department of Justice API. You can specify the number of results, search direction, and optional keyword filtering.

Usage

doj_press_releases(
  n_results = 50,
  search_direction = "DESC",
  keyword = NULL,
  clean = TRUE
)

Arguments

n_results

Integer. Number of press releases to retrieve. Default is 50.

search_direction

Character. "ASC" or "DESC" for ascending or descending sort by date. Default is "DESC".

keyword

Optional character string to filter results by keyword.

clean

Logical. If TRUE, cleans up the text fields. Default is TRUE.

Value

A cleaned dataframe containing DOJ press release metadata and content.

Examples

## Not run: 
# Retrieve a single DOJ press release
result <- doj_press_releases(n_results = 1)
print(result)

## End(Not run)