geoclient_api_key: Install Geoclient API Key for Repeated Use

Description Usage Arguments Examples

View source: R/geoclient_api_key.R

Description

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 key, it can be called any time by typing Sys.getenv("GEOCLIENT_KEY") and can be used in package functions by simply typing GEOCLIENT_KEY. 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 key to your existing file, while making a backup of your original file for disaster recovery purposes. You can acquire your Geoclient API Key by first registering with the NYC's API Portal at, then adding a "subscription" to the Geoclient User API.

Usage

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

Arguments

key

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

overwrite

If this is set to TRUE, it will overwrite the existing GEOCLIENT_KEY that you already have in your .Renviron file. And if key is set to NULL it will completely remove that line.

install

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# To set the keys for use in this session only:
geoclient_api_key(key = "9d8f7b6wh4jfgud67s89jfyw68vj38fh")

# To save the keys in your R.environ file for use in future sessions:
geoclient_api_key(
  key = "9d8f7b6wh4jfgud67s89jfyw68vj38fh",
  install = TRUE
 )

# If you need to overwrite existing keys:
geoclient_api_key("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_KEY")


## End(Not run)

austensen/geoclient documentation built on Nov. 20, 2021, 11:12 p.m.