• Stars
    star
    394
  • Rank 99,835 (Top 3 %)
  • Language
    R
  • Created about 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Packrat is a dependency management system for R

R-CMD-check

NOTE

Packrat has been soft-deprecated and is now superseded by renv.

While we will continue maintaining Packrat, all new development will focus on renv. If you're interested in switching to renv, you can use renv::migrate() to migrate a project from Packrat to renv.


packrat

Packrat is a dependency management system for R.

Use packrat to make your R projects more:

  • Isolated: Installing a new or updated package for one project won't break your other projects, and vice versa. That's because packrat gives each project its own private package library.
  • Portable: Easily transport your projects from one computer to another, even across different platforms. Packrat makes it easy to install the packages your project depends on.
  • Reproducible: Packrat records the exact package versions you depend on, and ensures those exact versions are the ones that get installed wherever you go.

See the project page for more information, or join the discussion on the RStudio Community forums.

Read the release notes to learn what's new in Packrat.

Quick-start Guide

Start by installing Packrat:

install.packages("packrat")

Then, start a new R session at the base directory of your project and type:

packrat::init()

This will install Packrat, set up a private library to be used for this project, and then place you in packrat mode. While in packrat mode, calls to functions like install.packages and remove.packages will modify the private project library, rather than the user library.

When you want to manage the state of your private library, you can use the Packrat functions:

  • packrat::snapshot(): Save the current state of your library.
  • packrat::restore(): Restore the library state saved in the most recent snapshot.
  • packrat::clean(): Remove unused packages from your library.

Share a Packrat project with bundle and unbundle:

  • packrat::bundle(): Bundle a packrat project, for easy sharing.
  • packrat::unbundle(): Unbundle a packrat project, generating a project directory with libraries restored from the most recent snapshot.

Navigate projects and set/get options with:

  • packrat::on(), packrat::off(): Toggle packrat mode on and off, for navigating between projects within a single R session.
  • packrat::get_opts, packrat::set_opts: Get/set project-specific settings.

Manage ad-hoc local repositories (note that these are a separate entity from CRAN-like repositories):

  • packrat::set_opts(local.repos = ...) can be used to specify local repositories; that is, directories containing (unzipped) package sources.
  • packrat::install_local() installs packages available in a local repository.

For example, suppose I have the (unzipped) package sources for digest located within the folder~/git/R/digest/. To install this package, you can use:

packrat::set_opts(local.repos = "~/git/R")
packrat::install_local("digest")

There are also utility functions for using and managing packages in the external / user library, and can be useful for leveraging packages in the user library that you might not want as project-specific dependencies, e.g. devtools, knitr, roxygen2:

  • packrat::extlib(): Load an external package.
  • packrat::with_extlib(): With an external package, evaluate an expression. The external package is loaded only for the duration of the evaluated expression, but note that there may be other side effects associated with the package's .onLoad, .onAttach and .onUnload calls that we may not be able to fully control.

Workflows

Packrat supports a set of common analytic workflows:

  1. As-you-go: use packrat::init() to initialize packrat with your project, and use it to manage your project library while you develop your analysis. As you install and remove packages, you can use packrat::snapshot() and packrat::restore() to maintain the R packages in your project. For collaboration, you can either use your favourite version control system, or use packrat::bundle() to generate a bundled version of your project that collaborators can use with packrat::unbundle().

  2. When-you're-done: take an existing or complete analysis (preferably collected within one directory), and call packrat::init() to immediately obtain R package sources for all packages used in your project, and snapshot that state so it can hence be preserved across time.

Setting up your own custom, CRAN-like repositories

Please view the set-up guide here for a simple walkthrough in how you might set up your own, local, custom CRAN repository.

More Repositories

1

shiny

Easy interactive web applications with R
R
5,095
star
2

cheatsheets

Posit Cheat Sheets - Can also be found at https://posit.co/resources/cheatsheets/.
TeX
5,081
star
3

rstudio

RStudio is an integrated development environment (IDE) for R
Java
4,360
star
4

bookdown

Authoring Books and Technical Documents with R Markdown
JavaScript
3,500
star
5

rmarkdown

Dynamic Documents for R
R
2,708
star
6

shiny-examples

JavaScript
1,882
star
7

gt

Easily generate information-rich, publication-quality tables from R
R
1,792
star
8

blogdown

Create Blogs and Websites with R Markdown
R
1,666
star
9

reticulate

R Interface to Python
R
1,590
star
10

webinars

Code and slides for RStudio webinars
HTML
1,510
star
11

rticles

LaTeX Journal Article Templates for R Markdown
TeX
1,382
star
12

plumber

Turn your R code into a web API.
R
1,347
star
13

tensorflow

TensorFlow for R
R
1,308
star
14

renv

renv: Project environments for R.
R
921
star
15

shinydashboard

Shiny Dashboarding framework
CSS
852
star
16

pagedown

Paginate the HTML Output of R Markdown with CSS for Print
R
842
star
17

keras

R Interface to Keras
R
802
star
18

pointblank

Data quality assessment and metadata reporting for data frames and database tables
R
766
star
19

leaflet

R Interface to Leaflet Maps
JavaScript
765
star
20

flexdashboard

Easy interactive dashboards for R
JavaScript
761
star
21

rmarkdown-book

R Markdown: The Definitive Guide (published by Chapman & Hall/CRC in July 2018)
RMarkdown
729
star
22

ggvis

Interactive grammar of graphics for R
R
709
star
23

shiny-server

Host Shiny applications over the web.
JavaScript
686
star
24

rstudio-conf

Materials for rstudio::conf
HTML
683
star
25

RStartHere

A guide to some of the most useful R Packages that we know about
R
656
star
26

py-shiny

Shiny for Python
Python
627
star
27

learnr

Interactive Tutorials with R Markdown
R
624
star
28

DT

R Interface to the jQuery Plug-in DataTables
JavaScript
563
star
29

rmarkdown-cookbook

R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
RMarkdown
545
star
30

blastula

Easily send great-looking HTML email messages from R
R
509
star
31

r2d3

R Interface to D3 Visualizations
R
506
star
32

bookdown-demo

A minimal book example using bookdown
CSS
472
star
33

distill

Distill for R Markdown
HTML
417
star
34

hex-stickers

RStudio hex stickers
R
414
star
35

bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
SCSS
381
star
36

tufte

Tufte Styles for R Markdown Documents
R
377
star
37

dygraphs

R interface to dygraphs
JavaScript
358
star
38

revealjs

R Markdown Format for reveal.js Presentations
JavaScript
316
star
39

pins-r

Pin, Discover and Share Resources
R
293
star
40

profvis

Visualize R profiling data
JavaScript
285
star
41

fontawesome

Easily insert FontAwesome icons into R Markdown docs and Shiny apps
R
284
star
42

crosstalk

Inter-htmlwidget communication for R (with and without Shiny)
JavaScript
277
star
43

config

config package for R
R
240
star
44

Intro

Course materials for "Introduction to Data Science with R", a video course by RStudio and O'Reilly Media
R
234
star
45

thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
R
234
star
46

pool

Object Pooling in R
R
232
star
47

shinytest

Automated testing for shiny apps
JavaScript
229
star
48

httpuv

HTTP and WebSocket server package for R
C
217
star
49

nomnoml

Sassy 'UML' Diagrams for R
JavaScript
212
star
50

tinytex-releases

Windows/macOS/Linux binaries and installation methods of TinyTeX
PowerShell
211
star
51

shinymeta

Record and expose Shiny app logic using metaprogramming
R
210
star
52

htmltools

Tools for HTML generation and output
R
201
star
53

promises

A promise library for R
R
183
star
54

shinyuieditor

A GUI for laying out a Shiny application that generates clean and human-readable UI code
JavaScript
181
star
55

vetiver-r

Version, share, deploy, and monitor models
R
167
star
56

gradethis

Tools for teachers to use with learnr
R
163
star
57

rstudioapi

Safely access RStudio's API (when available)
R
161
star
58

concept-maps

Concept maps for all things data science
HTML
156
star
59

master-the-tidyverse

Course contents for Master the Tidyverse
156
star
60

shinythemes

Themes for Shiny
R
152
star
61

ShinyDeveloperConference

Materials collected from the First Shiny Developer Conference Palo Alto, CA January 30-31 2016
HTML
150
star
62

chromote

Chrome Remote Interface for R
R
137
star
63

shiny-gallery

Code and other documentation for apps in the Shiny Gallery ✨
HTML
136
star
64

sortable

R htmlwidget for Sortable.js
R
124
star
65

rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
R
120
star
66

redx

dynamic nginx configuration
Lua
118
star
67

reactlog

Shiny Reactivity Visualizer
JavaScript
118
star
68

bigdataclass

Two-day workshop that covers how to use R to interact databases and Spark
R
112
star
69

shinyapps

Deploy Shiny applications to ShinyApps
110
star
70

shinyloadtest

Tools for load testing Shiny applications
HTML
108
star
71

shinyvalidate

Input validation package for the Shiny web framework
JavaScript
107
star
72

webshot2

Take screenshots of web pages from R
R
106
star
73

sass

Sass compiler package for R
C++
103
star
74

miniUI

R
102
star
75

r-docker

Docker images for R
Dockerfile
100
star
76

shinytest2

R
96
star
77

keras-customer-churn

Customer Churn Shiny Application
R
96
star
78

r-system-requirements

System requirements for R packages
Shell
92
star
79

r-builds

an opinionated environment for compiling R
Shell
88
star
80

addinexamples

An R package showcasing how RStudio addins can be registered and used.
R
84
star
81

r-manuals

A re-styled version of the R manuals
R
77
star
82

shinyapps-package-dependencies

Collection of bash scripts that install R package system dependencies
R
74
star
83

markdown

The first generation of Markdown rendering for R (born in 2012). Originally based on the C library sundown. Now based on commonmark. Note that this package is markdown, not *rmarkdown*.
R
72
star
84

R-Websockets

HTML 5 Websockets implementation for R
R
68
star
85

webdriver

WebDriver client in R
R
68
star
86

beyond-dashboard-fatigue

Materials for the RStudio webinar 'Beyond Dashboard Fatigue'
R
66
star
87

cloudml

R interface to Google Cloud Machine Learning Engine
R
65
star
88

rstudio-conf-2022-program

rstudio::conf(2022, "program")
R
62
star
89

shinylive

Run Shiny on Python (compiled to wasm) in the browser
TypeScript
61
star
90

bookdown.org

Source documents to generate the bookdown.org website
R
59
star
91

rstudio-docker-products

Docker images for RStudio Professional Products
Just
58
star
92

education.rstudio.com

CSS
57
star
93

tfestimators

R interface to TensorFlow Estimators
R
57
star
94

sparkDemos

HTML
54
star
95

tfprobability

R interface to TensorFlow Probability
R
54
star
96

shiny-incubator

Examples and ideas that don't belong in the core Shiny package and aren't officially supported.
JavaScript
53
star
97

swagger

Swagger is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
R
52
star
98

connections

https://rstudio.github.io/connections/
R
51
star
99

leaflet.mapboxgl

Extends the R Leaflet package with a Mapbox GL JS plugin to allow easy drawing of vector tile layers.
R
49
star
100

vetiver-python

Version, share, deploy, and monitor models.
Python
48
star