Learn R Programming

taxize (version 0.9.4)

getkey: Function to get API key.

Description

Checks first to get key from your .Rprofile or .Renviron (or similar) file. See Details.

Usage

getkey(x = NULL, service)

Arguments

x

(character) An API key, defaults to NULL

service

(character) The API data provider, used to match to default guest key (for Tropicos and EOL; there's no guest key for NCBI or IUCN, for which you have to get your own)

Details

Get help for getting and saving your keys via key_helpers. Save your API keys with the following names:

  • Tropicos: R option or env var as 'TROPICOS_KEY'

  • EOL: R option or env var as 'EOL_KEY'

  • IUCN: R option or env var as 'IUCN_REDLIST_KEY'

  • ENTREZ: R option or env var as 'ENTREZ_KEY'

as R options in your .Rprofile file, or as environment variables in either your .Renviron file or .bash_profile file, or .zshrc file (if you use oh-my-zsh) or similar. See Startup for help on R options and environment variables.

Remember to restart your R session (and to start a new shell window/tab if you're using the shell) to take advantage of the new R options or environment variables.

We strongly recommend using environment variables over R options.

Note that NCBI Entrez doesn't require that you use an API key, but you should get higher rate limit with a key, from 3 to 10 requests per second, so do get one.

Examples

Run this code
# NOT RUN {
getkey(service="tropicos")
getkey(service="eol")
getkey(service="iucn")
getkey(service="entrez")
# }

Run the code above in your browser using DataLab