Last active
April 10, 2021 22:46
-
-
Save philippmuench/a0135ac6e0ca9f502aad93cdf2ae8a45 to your computer and use it in GitHub Desktop.
packrat inside docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this line to your Dockerfile (you also need to install Rbase) | |
RUN R -e 'install.packages("packrat" , repos="http://cran.us.r-project.org"); packrat::restore()' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on your local machine install packrat | |
if (!require("devtools")) install.packages("devtools") | |
devtools::install_github("rstudio/packrat") | |
library(packrat) | |
# if this not work set lib path and repro, and try again | |
# setRepositories(ind = c(1:6, 8)) | |
# .libPaths( c("/path/to/your/R_library") ) | |
# after installing, type in the following commands | |
packrat::init() | |
packrat::clean() | |
packrat::snapshot() | |
# then make sure the packrat.lock, packrat.opts, init.R | |
# is located in the packrat/ folder and push these files to the repo if necessary |
is there a reason for using http
and not https
for repos link, though? insecure http
offers no security or server verification, so you might be downloading tampered packages.
....oh, probably because using https
throws and error:
Warning: unable to access index for repository https://cran.us.r-project.org/src/contrib:
cannot open URL 'https://cran.us.r-project.org/src/contrib/PACKAGES'
Warning message:
package ‘packrat’ is not available (for R version 3.5.1)
:P
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for this!