ws_incites_key: Find API Key for Incites

Description Usage Arguments Examples

Description

Determines if option(ws_incites_key) or option(ws_incites_key_filename) is set. If not, it stops and returns an error. If so, returns the value.

Usage

1
2
3
ws_incites_key(api_key = NULL, error = TRUE)

ws_have_incites_key(api_key = NULL)

Arguments

api_key

Web of Science API key

error

Should the function error if api_key = NULL after looking in various places? (See notes)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
res = ws_incites_key(error = FALSE)
tfile = tempfile()
writeLines("my_api_key", con = tfile)
options(ws_incites_key_filename = tfile)
ws_incites_key()
file.remove(tfile)
options(ws_incites_key_filename = NULL)

ws_filename = getOption("ws_incites_key_filename")
INCITES_KEY = Sys.getenv("INCITES_KEY")
Sys.setenv(INCITES_KEY = "")
writeLines(c("my_api_key1", "api_key2"), con = tfile)
options(ws_incites_key_filename = tfile)
testthat::expect_warning(ws_incites_key())
file.remove(tfile)
Sys.setenv(INCITES_KEY = INCITES_KEY)
options(ws_incites_key_filename = ws_filename)
ws_have_incites_key()

muschellij2/webofscience documentation built on May 14, 2019, 4:02 a.m.