I don't know exactly how RStudio.Version is doing what it does (and I'm curious to find out!), but you get the same info from rstudioapi::versionInfo()$version, so maybe that's a workaround?
That’s... disconcerting. Ceci n’est pas une pipe, indeed!
The details of the RStudio IDE-knitr alchemy are pretty murky to me. I’m hoping to learn more from this thread!
This seems like a bit of a forum categorization edge case, but I wonder if this question wouldn’t get more of the right eyeballs in the RStudio IDE category?
For the RStudio IDE vs R Markdown categories, it's tough to know where things go sometimes because R Markdown is so tightly integrated with the IDE. My loose heuristic so far: would this problem apply to somebody who uses R Markdown but doesn't use the RStudio IDE?
Sounds good. I've only ever used R Markdown in RStudio, so it's hard to imagine that people actually use it on its own. I'll give the thread a day or two in this forum, and if it doesn't get any love, I'll move it.
I have made an Rmd file to demonstrate a complex issue in R. I want the Rmd file to self-document the computer configuration under which it is executed. I don't have any problem making it report the operating system, the R version, and the versions of all the relevant packages. But, the RStudio version is elusive.
I'm not aware of a way to do this. I think the rationale is like so: the document you are making has no dependency on RStudio itself, but only on the packages used in your code and the rmarkdown/knitr toolchain. I suspect that everything in this thread is still true:
That being said, I can imagine that perhaps your document describes some sort of workflow that involves RStudio and, therefore, it would be nice to programmatically capture version info. I just don't think you can. I suspect you'll need to insert that yourself.
Thank you for the explanation. My report discusses text encoding and the inconsistencies in the way extended characters are rendered or encoded in RStudio and the knitted md and html files. I knit by clicking the [Knit] button, and I don't know if the code behind that button has changed across RStudio versions or if it just depends on the installed version of knitr.
I've implemented a work-around that will suffice if the Rmd file can't query RStudio. I put that chunk of code into a separate .R file, and I source it from the RStudio console. It puts its output into a csv file, which is what I wanted to do anyway. I still have the code chunk in the Rmd file, but I set eval=FALSE.
I'll wait and see if anyone posts a clever way to do this directly in the Rmd file. If not, then my work-around will be good enough.
Just to briefly revive this topic, the reason I'd like to be able to access RStudio.Version is to extract RStudio.Version()$citation, so I can cite RStudio in any RMarkdown reports I create. Not just for reproducibility's sake, but because I want y'all to get credit!
I'm working on a little script that automatically includes a citation in the References list for every package used in a .Rmd file, as well as citations for base R and RStudio. Then this script would be run in the setup chunk every time a document is knitted. But currently, I cannot automatically include the RStudio citation in this way.