set_api_key | R Documentation |
Get and set your openFDA API keys
set_api_key(api_key)
get_api_key()
api_key |
A single-length character vector with your openFDA API key. You can generate an API key on the FDA website. |
A single length character vector with your API key. For
set_api_key()
, this is returned invisibly.
For get_api_key()
, an error will be thrown if no key has been set.
To permanently set the API key for a given project, set OPENFDA_TOKEN
in .Renviron
.
# Set your openFDA API key with `set_api_key()`
api_key <- "example_api_key"
set_api_key(api_key)
# Retrieve it with `get_api_key()`
get_api_key()
# An error will be thrown if your API key is an empty string.
set_api_key("")
try(get_api_key())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.