-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
645 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Retrieve a Census API key stored the .Renivron file | ||
#' | ||
#' @returns A CENSUS_KEY or CENSUS_API_KEY value stored in the user's .Renviron. | ||
#' file. | ||
#' @export | ||
get_api_key <- function() { | ||
if (Sys.getenv("CENSUS_KEY") != "") { | ||
key <- Sys.getenv("CENSUS_KEY") | ||
key | ||
} else if (Sys.getenv("CENSUS_API_KEY") != "") { | ||
key <- Sys.getenv("CENSUS_API_KEY") | ||
key | ||
} else { | ||
rlang::warn("You do not have a stored Census API key. Using a key is recommended but not required.\nThe Census Bureau may limit your daily requests.\nRegister for an API key at https://api.census.gov/data/key_signup.html\nand store it in your Renviron file as CENSUS_KEY or CENSUS_API_KEY.\nLearn more at https://www.hrecht.com/censusapi/articles/getting-started.html.", | ||
.frequency = "once", .frequency_id = "api_key") | ||
key <- NULL | ||
key | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.