| 1 |
## ----include=FALSE------------------------------------------------------------ |
| 2 |
knitr::opts_chunk$set( |
| 3 |
collapse = TRUE, |
| 4 |
comment = "#>", |
| 5 |
eval = FALSE |
| 6 |
) |
| 7 |
|
| 8 |
## ----------------------------------------------------------------------------- |
| 9 |
# # restore packages from the lockfile, bypassing the cache |
| 10 |
# renv::restore(rebuild = TRUE) |
| 11 |
# |
| 12 |
# # re-install a package |
| 13 |
# renv::install("<package>", rebuild = TRUE) |
| 14 |
# |
| 15 |
# # rebuild all packages in the project |
| 16 |
# renv::rebuild() |
| 17 |
|
| 18 |
## ----------------------------------------------------------------------------- |
| 19 |
# # installation of RNetCDF may require us to set include paths for netcdf |
| 20 |
# configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2") |
| 21 |
# options(configure.args = configure.args) |
| 22 |
# renv::install("RNetCDF") |
| 23 |
|
| 24 |
## ----------------------------------------------------------------------------- |
| 25 |
# options( |
| 26 |
# configure.args.RNetCDF = "--with-netcdf-include=/usr/include/udunits2" |
| 27 |
# ) |
| 28 |
# renv::install("RNetCDF") |
| 29 |
|
| 30 |
## ----------------------------------------------------------------------------- |
| 31 |
# # installation of R packages using the Windows Subsystem for Linux |
| 32 |
# # may require the `--no-lock` flag to be set during install |
| 33 |
# options(install.opts = "--no-lock") |
| 34 |
# renv::install("xml2") |
| 35 |
# |
| 36 |
# # alternatively, you can set such options for specific packages with e.g. |
| 37 |
# options(install.opts = list(xml2 = "--no-lock")) |
| 38 |
# renv::install("xml2") |
| 39 |
|
| 40 |
## ----------------------------------------------------------------------------- |
| 41 |
# options(renv.download.override = utils::download.file) |
| 42 |
|
| 43 |
## ----------------------------------------------------------------------------- |
| 44 |
# # use Windows' internal download machinery |
| 45 |
# Sys.setenv(RENV_DOWNLOAD_METHOD = "wininet") |
| 46 |
# |
| 47 |
# # use R's bundled libcurl implementation |
| 48 |
# Sys.setenv(RENV_DOWNLOAD_METHOD = "libcurl") |
| 49 |
|
| 50 |
## ----------------------------------------------------------------------------- |
| 51 |
# getOption("download.file.method") |
| 52 |
|
| 53 |
## ----------------------------------------------------------------------------- |
| 54 |
# renv:::renv_download_method() |
| 55 |
|
| 56 |
## ----------------------------------------------------------------------------- |
| 57 |
# Sys.setenv(RENV_DOWNLOAD_METHOD = getOption("download.file.method")) |
| 58 |
|
| 59 |
## ----------------------------------------------------------------------------- |
| 60 |
# curl::ie_get_proxy_for_url() |
| 61 |
|
| 62 |
## ----------------------------------------------------------------------------- |
| 63 |
# # define a function providing authentication |
| 64 |
# options(renv.auth = function(package, record) { |
| 65 |
# if (package == "MyPackage") |
| 66 |
# return(list(GITHUB_PAT = "<pat>")) |
| 67 |
# }) |
| 68 |
# |
| 69 |
# # use a named list directly |
| 70 |
# options(renv.auth = list( |
| 71 |
# MyPackage = list(GITHUB_PAT = "<pat>") |
| 72 |
# )) |
| 73 |
# |
| 74 |
# # alternatively, set package-specific option |
| 75 |
# # as a list |
| 76 |
# options(renv.auth.MyPackage = list(GITHUB_PAT = "<pat>")) |
| 77 |
# # as a function |
| 78 |
# options(renv.auth.MyPackage = function(record) { |
| 79 |
# list(GITHUB_PAT = "<pat>") |
| 80 |
# }) |
| 81 |
|
| 82 |
## ----------------------------------------------------------------------------- |
| 83 |
# renv::install("igraph=igraph/rigraph") |
| 84 |
|
| 85 |
## ----------------------------------------------------------------------------- |
| 86 |
# options(renv.download.headers = function(url) { |
| 87 |
# if (grepl("^https://my/repository", url)) |
| 88 |
# return(c(Authorization = Sys.getenv("AUTH_HEADER"))) |
| 89 |
# }) |
| 90 |
|
| 91 |
## ----------------------------------------------------------------------------- |
| 92 |
# options(renv.download.trace = TRUE) |
| 93 |
|