It's best practice not to include your API key in scripts. Save it interactively with this function, then it will be available with Sys.getenv("DATAGOV_API_KEY"). All 'api_key' arguments in tidyfec functions default to Sys.getenv("DATAGOV_API_KEY").

save_datagov_apikey(key, overwrite = FALSE, install = FALSE)

Arguments

key

Your API Key

overwrite

TRUE or FALSE.

install

TRUE or FALSE

Details

Note: The code for save_datagov_apikey is lifted from Kyle Walker's tidycensus package (MIT License).