r-lib / rig

The R Installation Manager
MIT License
642 stars 22 forks source link

R installed via rig ignores `repos` option set in Rprofile and other issues/questions #87

Closed mbojan closed 2 years ago

mbojan commented 2 years ago

I just used rig on Windows to install two R releases and the R-devel. This works very nicely and promises to solve the pain of updating R on Windows (not to mention having several versions side by side). However I'm running into following issues:

  1. I set the repos option in my .Rprofile. R installed with rig sets default repos to RStudio package manager rather than CRAN (RSPM is the first element of getOption("repos")). Why is that? Still, thanks for --without-cran-mirror and --without-rspm.
  2. rig creates shortcuts on Desktop for each R version added. Is it possible to choose not to?

Thanks for developing this, @gaborcsardi .

Edit: Dropped the item about the install.packages() shim.

gaborcsardi commented 2 years ago

rig certainly does not ignore the repos option set in the user or site profile.

It does add RSPM and the cloud CRAN mirror as defaults to the internal system profile, which runs before the site profile and the user profile. If you want to use the original R default instead, you can certainly do that, by adding this to your user or site profile:

options(repos = c(CRAN = "@CRAN@"))

I set the repos option in my .Rprofile

I am pretty sure that rig does not change that. Maybe you use parts of the previous value of repos, set by rig in the system profile? Just guessing, impossible to be sure without seeing your code that sets repos.

As for why rig sets RSPM, it is because it is superior to CRAN mirrors on older R versions, in that it contains binary packages for new package versions for these. I.e. if there is a new version of rlang coming out now, then CRAN will only build binaries for this package on R-release and R-devel (and maybe sometimes on R-oldrel), but RSPM will build binaries for older R versions as well.

E.g. this is on R 3.6.x:

> pak::meta_list("rlang")[, c("package", "version", "platform", "mirror")]
# A tibble: 4 x 4
  package version platform                mirror
  <chr>   <chr>   <chr>                   <chr>
1 rlang   1.0.2   i386+x86_64-w64-mingw32 https://packagemanager.rstudio.com/al~
2 rlang   1.0.2   source                  https://packagemanager.rstudio.com/al~
3 rlang   0.4.11  i386+x86_64-w64-mingw32 https://cloud.r-project.org
4 rlang   1.0.2   source                  https://cloud.r-project.org

rig creates shortcuts on Desktop for each R version added. Is it possible to choose not to?

That is not rig, but it is the new default of the R installer, AFAIR from version 4.2.0. It is a very annoying default, I agree, and I'll look into changing it: https://github.com/r-lib/rig/issues/89

mbojan commented 2 years ago

Thanks @gaborcsardi . Closing.