/jetpack

A friendly package manager for R

Primary LanguageROtherNOASSERTION

Jetpack

🔥 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

Screenshot

Inspired by Yarn and Bundler

Build Status

Installation

Install Jetpack

install.packages("devtools")
devtools::install_github("ankane/jetpack")
jetpack::createbin()

Getting Started

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.

Commands

Install

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

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

Update a package

jetpack update dplyr

Remove

Remove a package

jetpack remove dplyr

Remove remotes as well

jetpack remove dplyr --remote=github::tidyverse/dplyr

Source Control

Be sure to commit all files Jetpack generates to source control, except for the packrat/lib*/ directories.

RStudio

Jetpack can also be used from within RStudio.

jetpack.install()
jetpack.add("jsonlite")

Deployment

Server

Install Jetpack on the server and run:

jetpack install --deployment

Docker

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.

Heroku

There’s ongoing work to get Packrat working on Heroku.

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: