How do we set constant variables while building R packages? : <p>We are building a package in R for our service (a robo-advisor here in Brazil) and we send requests all the time to our external API inside our functions. </p>

<p>As it is the first time we build a package we have some questions. :(</p>

<p>When we will use our package to run some scripts we will need some information as <code>api_path, login, password</code>.</p>

<p>How do we place this information inside our package? </p>

<p>Here is a real example:</p>

<pre><code>get_asset_daily &lt;- function(asset_id) {
    api_path &lt;- "https://api.verios.com.br"

    url &lt;- paste0(api_path, "/assets/", asset_id, "/dailies?asc=d")
    data &lt;- fromJSON(url)
    data
}
</code></pre>

<p>Sometimes we use a <code>staging</code> version of the API and we have to constantly switch paths. How we should call it inside our function? </p>

<p>Should we set a global environment variable, a package environment variable, just define <code>api_path</code> in our scripts or a package config file?</p>

<p>How do we do that? </p>

<p>Thanks for your help in advance.</p>

<p>Ana</p>
