Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit bbf0eba

Browse files
committed
Fix Rprofile.site to point to correct mirror
Earlier, interactive use of R somehow wasn't loading appropriate instructions on setting CRAN from Rprofile.site, resulting (partially) in errors like this: berkeley-dsep-infra/datahub#2255 (comment) My informed guess is that the `local{}` was scoping the effects, so it worked during build but not during interactive use. Removing that seems to make it work for both. Inspired by toolforge/paws#62
1 parent 4054744 commit bbf0eba

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
local({
2-
r <- getOption("repos")
3-
r["CRAN"] <- "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
4-
options(repos = r)
5-
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))
6-
})
1+
# Use RStudio's CRAN mirror to get binary packages
2+
# 'latest' just means it has all available versions.
3+
# We can specify version numbers in devtools::install_version
4+
options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/focal/latest"))
5+
6+
# RStudio's CRAN mirror needs this to figure out which binary package to serve.
7+
# If not set properly, it will just serve up source packages
8+
# Quite hilarious, IMO.
9+
# See https://docs.rstudio.com/rspm/admin/binaries.html
10+
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
local({
2-
r <- getOption("repos")
3-
r["CRAN"] <- "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
4-
options(repos = r)
5-
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))
6-
})
1+
# Use RStudio's CRAN mirror to get binary packages
2+
# 'latest' just means it has all available versions.
3+
# We can specify version numbers in devtools::install_version
4+
options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/focal/latest"))
5+
6+
# RStudio's CRAN mirror needs this to figure out which binary package to serve.
7+
# If not set properly, it will just serve up source packages
8+
# Quite hilarious, IMO.
9+
# See https://docs.rstudio.com/rspm/admin/binaries.html
10+
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))

0 commit comments

Comments
 (0)