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) readRenviron("~/.Renviron")
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
.Renvironfile in the
.Rmdbecause that happens at the beginning of a new R session automatically. You only need to do this after you change the
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(): Sys.getenv("SHERPAROMEO_KEY") Sys.setenv(SHERPAROMEO_KEY = "myapicode")
Also, nothing seems to work unless I write:
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