How do I get rmarkdown 1.2 with Microsoft R Open 3

2019-01-18 00:49发布

I am using RStudio 1.0.136 with Microsoft R Open 3.3.2 When I do File --> New File --> R Markdown... it says

rmarkdown 1.2 is required but 1.1 is available

And

Check that getOption("repos") refers to a CRAN repository that contains the needed package versions

And

getOption("repos") gives me this:

                                                      CRAN 
"https://mran.revolutionanalytics.com/snapshot/2016-11-01" 
                                                 CRANextra 
                      "http://www.stats.ox.ac.uk/pub/RWin" 

Where do I go from here?

1条回答
太酷不给撩
2楼-- · 2019-01-18 01:18

One of the things we do with MRO (and other MS R distributions) is to point the default repository to a static point-in-time snapshot, for the purposes of reproducibility.

From https://mran.revolutionanalytics.com/documents/rro/reproducibility/:

For example, a package you used yesterday may have been updated overnight, or maybe one of its dependencies did, and now your script no longer works as expected. Developers are left wondering, "When do they plan to fix and update this package? Do I need to rewrite my script?” Packages get fixed whenever their maintainers choose to do so -- whether that's today, tomorrow, or next month. Each time a package breaks, so will all of the scripts using that version of the package. This approach is clearly suboptimal with respect to the stability that R programmers crave.

Similarly, whenever users point to the latest CRAN repository, install.packages could install one version of the package for 'User_A' today, another version of that same package for 'User_B' who points to a different mirror, or even a “package not found” error when 'User_C' attempts to install tomorrow. Once again, this inconsistency presents challenges when sharing scripts.

In your case, the snapshot you're using is as of Nov 1, 2016. At that date, the latest version of rmarkdown was 1.1. If you run install.packages, you will get that version and not anything more recent.

If you definitely want rmarkdown 1.2, you can override the default repo in your install.packages call:

install.packages("rmarkdown", repos="https://cloud.r-project.org")
查看更多
登录 后发表回答