recalls: Get recall data

Description Usage Arguments Details Value Author(s) Examples

View source: R/recalls.r

Description

Retrieve recall data from the DigitalGov.gov Recall API

Usage

1
2
3
4
5
recalls(query = NULL, organization = NULL,
        start_date = NULL, end_date = NULL,
        food_type = NULL, upc = NULL,
        make = NULL, model = NULL, year = NULL, code = NULL,
        page = 1, per_page = 50, sort = NULL, ...)

Arguments

query

A character string that will be used in search recall data. The API executes approximate matching (e.g., so “choke” will also return “choking”.

organization

A character vector naming one or more federal agencies, by abbreviation. One of “CPSC”, “FDA”, “NHTSA”, or “USDA”.

start_date

A character string containing the start date of a recall in YYYY-MM-DD format.

end_date

A character string containing the end date of a recall in YYYY-MM-DD format.

food_type

An optional character string containing either “food” or “drug” to narrow results only to food or drug recalls.

upc

An optional character string containing a product UPC code.

make

For vehicle recalls, a character string naming a vehicle or equipment make.

model

For vehicle recalls, a character string naming a vehicle or equipment model.

year

For vehicle recalls, a character string naming a vehicle or equipment year.

code

For vehicle recalls, a character string naming an NHTSA code. One of “E”, “V”, “I”, “T”, “T”, “C”, or “X”.

page

A numeric value or character string specifying a specific page of results to return (between 1 and 20). Setting page=NULL will force a return of all available pages (i.e., the first 1000 results). Attempting to request more than 1000 results will produce a message.

per_page

A numeric value or character string specifying a page size for results (between 1 and 50). This is overridden to 50 if page=NULL.

sort

A character string specifying whether to sort result by relevance (“rel”; the default) or date (“date”).

...

Other arguments. Currently ignored.

Details

The particular objects returned will vary in structure depending on type of recall. As a result, attempting to build a rectangular dataset from different types of recall data may prove complicated. It is recommended to retrieve recalls of only one type if the goal is to rbind the list of results into a matrix or data.frame.

Value

A list containing one or more objects of class “recall”.

Author(s)

Thomas J. Leeper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# by organization
recalls(organization = 'CPSC')

# food
recalls(query='peanut butter', food_type='food')

# product
recalls(query='burn')

# vehicle
recalls(make='ford', year='2010')
recalls(make='ford', year='2011')


## End(Not run)

rOpenGov/recalls documentation built on May 26, 2019, 8:48 p.m.