extractFDA-methods: An S4 method to extract information from the open FDA API

Description Usage Arguments Value See Also Examples

Description

extractFDA(Obj, endpointtype, query) for classes other than Other will extract tables based on the query. The Other class only has one API endpoint therefore doesn't require endpointtype (i.e. extractFDA(Obj, endpointtype, query))

Usage

1
2
3
4
5
6
7
extractFDA(Obj, endpointtype, query, ...)

## S4 method for signature 'FDA'
extractFDA(Obj, endpointtype, query, ...)

## S4 method for signature 'Other'
extractFDA(Obj, endpointtype, query, ...)

Arguments

Obj

An Obj of class FDA or child thereof.

endpointtype

The endpoint after the class endpoint. For example, If the Obj is of type indicating the endpoint for the specific class. For example, for the class Drug, the endpointtype may be "event".

query

string of query to access FDA API. For example, If we want to do "https://api.fda.gov/drug/event.json?search=receivedate:[20040101+TO+20081231]&limit=1", we would do extractFDA(drugObj, endpointtype="event", query="receivedate:[20040101+TO+20081231]&limit=1"

...

Passed down to searchlist within the function

Value

An object of a class data.frame

See Also

https://open.fda.gov/apis/drug/ndc/ for the actual API description from openFDA. jsonlite for accessing API.

Examples

1
2
3
4
5
6
7
8
9
drug1 <- new("Drug", apikey="Y3CgaZj67AotB7b4XLhzHJTY7oBWKUC3u1fYulw8")
drug1tab <- extractFDA(drug1, "event", "receivedate:[20040101+TO+20081231]&limit=1")

## Not run: 
  drugnorun <- extractFDA("Food")
  drugnorun <- extractFDA(drug1, "random") # not a valid access endpoint
  drugnorun <- extractFDA(drug1, "event", "randomquery") # not a valid query

## End(Not run)

ck2136/FDAopenR documentation built on Aug. 15, 2021, 3:43 a.m.