geoclient_api_keys: Install Geoclient API ID and Key for Repeated Use

Description Usage Arguments Examples

View source: R/geoclient_api_keys.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 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.

Usage

1
geoclient_api_keys(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

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

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

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


## End(Not run)

austensen/geoclient documentation built on Jan. 22, 2018, 9:12 p.m.