knitr::opts_chunk$set(collapse=TRUE, comment="##", fig.retina=2, fig.path = "README <- figs/README-")
FDAopenR
: R package for accessing and manipulating openFDA API.
The following functions are implemented:
# you'll want to see the vignettes, trust me library("devtools") devtools::install_github("ck2136/FDAopenR") # for now not on CRAN :(
options(width=120)
library("FDAopenR") library("dplyr") # current verison packageVersion("FDAopenR") # - - - - - - - - - - - - - - - - - - - - - # # Instantiate example classes # - - - - - - - - - - - - - - - - - - - - - # drug1 <- new(Class="Drug", ndc = 687889736, apikey="Y3CgaZj67AotB7b4XLhzHJTY7oBWKUC3u1fYulw8" ) device1 <- new(Class="Device", apikey="Y3CgaZj67AotB7b4XLhzHJTY7oBWKUC3u1fYulw8" ) food1 <- new(Class="Food", apikey="Y3CgaZj67AotB7b4XLhzHJTY7oBWKUC3u1fYulw8" ) other1 <- new(Class="Other", ndc=6382447364, apikey="Y3CgaZj67AotB7b4XLhzHJTY7oBWKUC3u1fYulw8" )
drug1@ndcquery drug1 <- ndcToString(drug1) drug1@ndcquery #ndcToString(device1) # this will be an error! other1 <- ndcToString(other1) other1 %>% str(max.level=2)
listSF(drug1,"event") %>% head listSF(drug1,"label") %>% head listSF(drug1,"ndc") %>% head listSF(device1,"510k") %>% head listSF(device1,"classification") %>% head listSF(device1,"enforcement") %>% head listSF(device1,"event") %>% head listSF(device1,"pma") %>% head listSF(device1,"recall") %>% head listSF(device1,"registrationlisting") %>% head listSF(device1,"udi") %>% head listSF(food1,"enforcement") %>% head listSF(food1,"event") %>% head listSF(other1) %>% head
extractFDA(drug1,"event","receivedate:[20040101+TO+20081231]&limit=15")[1:5,1:5] extractFDA(drug1,"ndc", "finished:true&limit=3")[1:5,1:5] extractFDA(device1,"registrationlisting",'')[1:5,1:5] extractFDA(device1,"udi",'public_version_status:Update')[1:5,1:5] extractFDA(device1,"pma",'decision_code:APPR&limit=3')[1:5,1:5] extractFDA(food1, "enforcement", 'report_date:[20040101+TO+20131231]&limit=3')[1:5,1:5] extractFDA(food1, "event", 'date_created:[20040101+TO+20131231]&limit=5')[1:5,1:5] extractFDA(other1, query='marketing_start_date:[20040101+TO+20131231]&limit=5')[1:5,1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.