apparent conflicts between workbench preference and Rprofile.site

I am encountering issues with the Rprofile.site configuration for our workbench pro server.
In particular, we have custom frozen versions of R in /opt/R/x.y.z, and I would like to link to each of them a snapshot of CRAN from Rstudio Public Package Manager.

So, as I found in many resources also from RStudio, I created the /opt/R/x.y.z/lib/R/etc/Rprofile.site and, inside, I put (only), e.g., for x.y.z = 4.1.3:

local({
  options(
    repos = c(
      CRAN = "https://packagemanager.rstudio.com/all/2022-04-21+Y3JhbiwyOjQ1MjYyMTU7NDAxNEZFQzY"
    )
  )
})

Anyway, that seems to not affect it at all on the startup configuration, and I continue to get the following output from any session

> getOption("repos")
                       CRAN 
"https://cran.rstudio.com/" 
attr(,"RStudio")
[1] TRUE

As it is set in the RStudio global preferences.

I have tried to restart the server, to remove user- and project-level .Rprofile(s), the result is still the same.
I would need to set a default repo for users who do not set it on their own; how can I investigate/solve that?

Thank you,
Corrado.

This is a long shot, but are you including a trailing empty line after saving? Otherwise R won’t source this, at least I have learned at the user-level

1 Like

Couple of questions/comments:

  1. If you run the respective R version from the command line, e.g. /opt/R/x.y.z/bin/R -q -e 'getOption("repos")', does it report the correct/expected output there ? If this works, then something eclipses this setting on the Workbench side.

  2. If the behaviour is the same for all users, it could be a system setting. Can you maybe check for the existence of the RSW config files/parameters as specified at Setting Default Repositories - RStudio :: Solutions ?

  3. If this does not help, it still could be a setting in your local user account under ~/.local/share/rstudio. You could simply move this folder out of the way for a moment, start a new session and see if this changes things.

PS: There is one scenario where RSW defines the CRAN repo in the way you find in your system (pointing to https://cran.rstudio.com - this is when there is no repo defined on neither the R nor the RSW side.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.