[R-pkg-devel] If Your Function Require API Key Input, How to get around check errors as the key is not provided?

Edward Wei edwwe|2020 @end|ng |rom gm@||@com
Fri Jun 3 22:00:22 CEST 2022


When releasing a package, API Keys are not supposed to be available for
those who download it. However, the package I am building requires the API
key to be able to pull the data for the examples. Should I just comment out
the examples so the error doesn't come?

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: crypto60
> ### Title: Get Cryptocurrency Data at the hourly level localized to current
> ###   time zone
> ### Aliases: crypto60
>
> ### ** Examples
>
> crypto60("BTC")
Error: Set API key using av_api_key(). If you do not have an API key,
please claim your free API key on
(https://www.alphavantage.co/support/#api-key). It should take less
than 20 seconds, and is free permanently.
Execution halted
* checking PDF version of manual ... OK
* checking for detritus in the temp directory ... OK
* DONE
Status: 1 ERROR, 3 NOTEs

To resolve errors, one would simply have to run
av_api_key("YOUR_AV_KEY_HERE")
before running any queries. Is there a way to provide a key for testing but
at the same time mask it from those who would potentially download your
package? Or is there a way to not have these functions (that require API
key to pull data) be subject to the test for spitting out errors.

Another "problem"  I am running into is the following.:It is a NOTE but I
am new at this and not sure whether or not I would need to resolve it for a
submission.

* checking R code for possible problems ... [8s] NOTE
addreturns: no visible binding for global variable 'returns'
addreturns: no visible binding for global variable 'idreturns'
addreturns: no visible binding for global variable 'tot_ret'
addreturns: no visible binding for global variable 'high'
addreturns: no visible binding for global variable 'low'
get60: no visible binding for global variable 'a'
project_price: no visible binding for global variable 'hs'
volatility_freq: no visible binding for global variable 'high'
volatility_freq: no visible binding for global variable 'low'
volatility_freq: no visible binding for global variable 'hilow'
volatilty_freq_cum: no visible binding for global variable 'high'
volatilty_freq_cum: no visible binding for global variable 'low'
volatilty_freq_cum: no visible binding for global variable 'hilow'
Undefined global functions or variables:
  a high hilow hs idreturns low returns tot_ret

All of the variables that have been named are defined within the functions
I am building. They do not and should not exist outside the function. I do
not think this is a problem I really need to resolve for a successful
submission. Is that correct?

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list