🔥 A friendly package manager for R
- Easy to use
- Designed for reproducibility (thanks to Packrat, no more global installs!)
- Great for collaboration
- Secure by default
Install Jetpack
install.packages("devtools")
devtools::install_github("ankane/jetpack")
jetpack::createbin()
In your project directory (outside of R), run:
jetpack init
This sets up Packrat and creates a DESCRIPTION
file to store your dependencies.
If your project uses Git, packrat/lib*/
is added to your .gitignore
.
Install packages for a project
jetpack install
Whenever a teammate adds a new package, others just need to run this command to keep packages in sync. Do the same when a new member joins the project.
install
is optional.
Add a package
jetpack add dplyr
Add a specific version
jetpack add dplyr@0.7.5
Add from GitHub or another remote source
jetpack add dplyr --remote=github::tidyverse/dplyr
Supports all of these remotes
Add from a specific tag, branch, or commit
jetpack add dplyr --remote=github::tidyverse/dplyr@v0.7.5
Add from a local source
jetpack add dplyr --remote=local::/path/to/dplyr
The local directory must have the same name as the package
Update a package
jetpack update dplyr
Remove a package
jetpack remove dplyr
Remove remotes as well
jetpack remove dplyr --remote=github::tidyverse/dplyr
Be sure to commit all files Jetpack generates to source control, except for the packrat/lib*/
directories.
Jetpack can also be used from within RStudio.
jetpack.install()
jetpack.add("jsonlite")
Install Jetpack on the server and run:
jetpack install --deployment
Create an init.R
with:
install.packages("packrat")
source("packrat/init.R")
packrat::restore()
And add it into your Dockerfile
:
FROM r-base
RUN apt-get update && apt-get install -qq -y --no-install-recommends \
libxml2-dev libssl-dev libcurl4-openssl-dev
RUN mkdir -p /app
WORKDIR /app
COPY packrat ./packrat
COPY init.R ./
RUN Rscript init.R
COPY . .
CMD Rscript app.R
(no need to install Jetpack on the image)
Also, add packrat/lib*/
to your .dockerignore
.
There’s ongoing work to get Packrat working on Heroku.
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features