Skip to content

Instantly share code, notes, and snippets.

@zsusswein
Last active November 22, 2023 15:41
Show Gist options
  • Save zsusswein/fba2e72c2674f16cb2b3529cbc141bed to your computer and use it in GitHub Desktop.
Save zsusswein/fba2e72c2674f16cb2b3529cbc141bed to your computer and use it in GitHub Desktop.
Include to default to precompiled package binaries on Linux
# Set default user agent header
options(HTTPUserAgent = sprintf(
"R/%s R (%s)",
getRversion(),
paste(
getRversion(),
R.version["platform"],
R.version["arch"],
R.version["os"]
)
)
)
# Also use this user agent header for wget and curl from within R
options(download.file.extra = sprintf("--header \"User-Agent: R (%s)\"",
paste(getRversion(),
R.version["platform"],
R.version["arch"],
R.version["os"])
)
)
UBUNTU_FLAVOR = system("grep UBUNTU_CODENAME /etc/os-release | cut -d '=' -f2",
intern = TRUE)
options(repos = c(CRAN = sprintf("https://packagemanager.rstudio.com/all/__linux__/%s/latest",
UBUNTU_FLAVOR
),
getOption("repos")
)
)
rm(UBUNTU_FLAVOR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment