🔥 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
Download the Jetpack CLI
curl https://raw.githubusercontent.com/ankane/jetpack/v0.1.0/jetpack > /usr/local/bin/jetpack
chmod +x /usr/local/bin/jetpack
With Homebrew, you can use:
brew install ankane/brew/jetpack
In your project directory, 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 [email protected]
Due to a bug with devtools, packages added this way are reinstalled every time you run jetpack
Add from GitHub or another remote source
jetpack add dplyr --remote=github::tidyverse/dplyr
Supports all of these remotes
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.
Install Jetpack on the server and run:
jetpack install
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