This function will add your Geoclient app ID and key to your .Renviron file so they can be called securely without being stored in your code. After you have installed your ID and key, they can be called any time by typing Sys.getenv("GEOCLIENT_APP_ID") and Sys.getenv("GEOCLIENT_APP_KEY") and can be used in package functions by simply typing GEOCLIENT_APP_ID or GEOCLIENT_APPKEY. If you do not have an .Renviron file, the function will create on for you. If you already have an .Renviron file, the function will append the ID and key to your existing file, while making a backup of your original file for disaster recovery purposes. You can acquire your Geoclient app ID and Key by first registering with the NYC's Developer Portal at, then create a new project, selecting "Geoclient v1" from available APIs.

geoclient_api_key(id, key, overwrite = FALSE, install = FALSE)

Arguments

id

The API app ID provided to you from the NYC Developer Portal formated in quotes.

key

The API app key provided to you from the NYC Developer Portal formated in quotes.

overwrite

If this is set to TRUE, it will overwrite the existing GEOCLIENT_APP_ID and GEOCLIENT_APP_KEY that you already have in your .Renviron file. And if id and key are set to NULL it will completely remove these lines.

install

if TRUE, will install the key in your .Renviron file for use in future sessions. Defaults to FALSE.

Examples

# NOT RUN { # To set the keys for use in this session only: geoclient_api_key(id = "1a2b3c4", key = "9d8f7b6wh4jfgud67s89jfyw68vj38fh") # To save the keys in your R.environ file for use in future sessions: geoclient_api_key( id = "1a2b3c4", key = "9d8f7b6wh4jfgud67s89jfyw68vj38fh", install = TRUE ) # If you need to overwrite existing keys: geoclient_api_key("1a2b3c4", "9d8f7b6wh4jfgud67s89jfyw68vj38fh", overwrite = TRUE, install = TRUE) # First time, reload your environment so you can use the keys without restarting R. readRenviron("~/.Renviron") # You can check them with: Sys.getenv("GEOCLIENT_APP_ID") Sys.getenv("GEOCLIENT_APP_KEY") # }