This function checks if the user has stored a valid Protected Planet API token in the R environment file (.Renviron).

get_token(key = "WDPA_KEY")

Arguments

key

a character providing the WDPA token name stored in the .Renviron file. Default is WDPA_KEY.

Value

A vector of length one with the value of the API token.

Details

Before using this package for the first time, the user must follow these steps:

  • Fill in the form available at: https://api.protectedplanet.net/request to obtain a personal API token;

  • Store the token in the .Renviron file under the key WDPA_KEY. User can use the function usethis::edit_r_environ to open this file;

  • Restart R.

Examples

if (FALSE) { ## Check if Protected Planet API token is stored ---- worldpa::get_token() }