Created
April 9, 2019 08:02
-
-
Save PaulC91/7b42a252f4c4aced83dd5ab516ba3118 to your computer and use it in GitHub Desktop.
lightweight packrat setup as outlined here: https://milesmcbain.xyz/packrat-lite/
This file contains hidden or 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
# ================================================================================= | |
# lightweight packrat setup as outlined here: https://milesmcbain.xyz/packrat-lite/ | |
# ================================================================================= | |
# initiliase a packrat project in your project directory | |
packrat::init( | |
infer.dependencies = FALSE, | |
options = list(vcs.ignore.lib = TRUE, vcs.ignore.src = TRUE) | |
) | |
# install any packages you are using in your project | |
install.packages(c('drake', 'readr', 'dplyr', 'lubridate', 'rmarkdown', 'ggplot2')) | |
# take a snapshot of the project's current state | |
# this will create a number of files but we only want to version control packrat.lock | |
# so add the following to your .gitignore: | |
# ./packrat/packrat.opt | |
# ./.Rprofile | |
# ./packrat/init.R | |
packrat::snapshot( | |
ignore.stale = TRUE, | |
snapshot.sources = FALSE, | |
infer.dependencies = FALSE | |
) | |
# to restore a packrat library, run the following 2 functions | |
# on a fresh clone of a project | |
packrat::restore() | |
packrat::init( | |
infer.dependencies = FALSE, | |
options = list(vcs.ignore.lib = TRUE, vcs.ignore.src = TRUE) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment