CRAN repositories modified outside package preferences

On Windows, RStudio seems to use Microsoft's R Client / R Open (not really familiar with it) by default, which uses CRAN snapshots of specific dates to ensure reproducibility.

To compile a bookdown document, I need newer versions of some packages.

getOption("repos")

"https://mran.revolutionanalytics.com/snapshot/2016-11-01"

indicates the older snapshot of the CRAN repository ("2016") used by Microsoft's R installation, which I therefore wanted to change.
However, changing it with the dialog available via "Tools > Global options... > Packages" has no effect.
The dialog "Tools > Global options... > Packages" tells me "CRAN repositories modified outside package preferences".

I'm using RStudio 1.2.1335 on Windows 10 (not really my favourite platform - on Linux everything works fine).

Is anyone familiar with pointing Microsoft's R client to a newer snapshot or the current CRAN server?
On https://mran.microsoft.com/faq#change-repos, Microsoft gives some information, but the suggested options(repos = c(CRAN = "https://mran.revolutionanalytics.com/snapshot/YYYY-MM-DD")) (adapted YYYY-MM-DD) did cause update.packages() to update packages.

First, RStudio does not ship with R and use any of your R version you have installed and tells it to use. By default, it is your default R version on your system.
It seems you have Microsoft R client installed for RStudio to use.
You can change that by installing a new R version for CRAN and pointing RStudio to use it.

Changing it this way is the correct way. You can even point to a non MRAN repo like

options(repos = c(CRAN = "https://cran.rstudio.com"))

Then your default repos will be this new one you change it too so yes, running update.packages will update the package.
You can install only the package you want to update by reinstalling them one by one.

to update a subset of packages, I think this is like that

update.packages(oldPkgs = c("bookdown", "rmarkdown"))

as explained in ?update.packages

What did you try after changing the repos to a new MRAN snapshot ?
What is the issue ?

3 Likes

Thanks a lot for your answer, which helped me a lot.

Pointing to a non MRAN repository with

options(repos = c(CRAN = "https://cran.rstudio.com"))

was what finally solved the issue for me.
I hope this well be of help for other people with a similar question.

What could also be helpful for other users:
It is also possible to install the official R version and point RStudio to use it.

2 Likes

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