Understanding Renviron and API


I am trying to understand a little bit about how Renviron works. I am using the qualtRics package to pull my survey results of Qualtrics, and clean& analyse in R, using markdown.

To do this, I need to state my API credentials and base url, both of which I have. The code for this looks like

qualtrics_api_credentials(api_key = "myapidcode",
                          base_url = "mybaseurl.qualtrics.com",
                          install = TRUE, overwrite = TRUE)

However, if I share my markdown, I don't want my API to be visible, and I was told * You probably do not want to install your API credentials in your .Rmd . Instead, write these to your .Renviron interactively and then use them all the time from there.

  • You do not need to read your .Renviron file in the .Rmd because that happens at the beginning of a new R session automatically. You only need to do this after you change the .Renviron .

So then I looked up how to store my API in Renviron (still not sure what Renviron actually is) and looks like this:

Sys.setenv(SHERPAROMEO_KEY = "myapicode")

Also, nothing seems to work unless I write:

chooseCRANmirror(graphics=FALSE, ind=1)

So, where do I store my API and base URL? Do I need both the first and second lots of code in this question? I would be grateful for any insight! Thanks all for your patience

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.