A package for accessing the GIDEON API using R.
The gideon package provides functions to access the GIDEON API without the need of writing your own REST API queries.
Download and install RStudio Desktop for a complete R integrated development environment
Execute the following commands in the the R console:
install.packages("devtools")
devtools::install_github("gideononline/gideon-api-r")
library(gideon)
Type ?gideon
or help(gideon)
into the R console to get the package documentation and overview of capabilities.
All calls to the GIDEON API require an API key to work.
Provide your GIDEON API key as an R environment variable by appending the following line to your .Renviron file: GIDEON_API_KEY=<YOUR API KEY>
.
The .Renviron file can be edited. by running the command usethis::edit_r_environ()
in the R console.
Many of the items in the GIDEON database use an id code, such as diseases, bacteria, drugs, etc.
Use lookup_gideon_id
to get specific item code to use when calling the GIDEON API.
The functions to query outbreaks are:
Functions to access the GIDEON API directly
library(gideon)
cholera_code <- lookup_gideon_id("diseases", "Cholera")
cholera_outbreaks <- outbreaks_by_disease(cholera_code)
us_country_code <- lookup_gideon_id("countries", "United States")
outbreaks_us_2007 <- outbreaks_by_country_year(us_country_code, 2007)
outbreaks_2009 <- outbreaks_by_year(2009)
to_geojson(outbreaks_2009, 'outbreaks2009.geojson')
mosquito_vector_code <- lookup_gideon_id("vectors", "Mosquito")
horse_reservoir_code <- lookup_gideon_id("reservoirs", "Horse")
diseases_from_horses_via_mosquitos <- filter_diseases(
vector = mosquito_vector_code,
reservoir = horse_reservoir_code
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.