Learn R Programming

nutrientr (version 0.1)

get_key: Retrieves the API key

Description

get_key stops execution and returns an error message if the environment variable CN_API is not set to the user's API key. If the environment variable is not set, the function returns an error message.

Usage

get_key()

Arguments

Value

The user's API key, if set as an environment variable. If key is not set, returns an error message indicating that the user can either set the environment variable CN_API or pass the API key as an argument to the function.

References

Note that this function is based on, and repeats much of the code in the R API package best practices, available at https://httr.r-lib.org/articles/api-packages.html#overall-design-1.

Examples

Run this code
# NOT RUN {
get_key()
# }

Run the code above in your browser using DataLab