The promises package brings asynchronous programming capabilities to R. Asynchronous programming is a technique used by many programming languages to increase scalability and responsiveness. Traditionally, this style of programming has not been useful to R users. But the advent of R web applications like Shiny has made async programming relevant.

This website provides a multi-step guide that will help familiarize you with several related concepts that are required for effective async programming. It is highly recommended that you go through the topics in order.


Installation

You can install both the promises package and an async-compatible version of Shiny (requires v1.1+) just by installing Shiny from CRAN:

There are also some supporting packages that have experimental async-compatible branches:

devtools::install_github("ramnathv/htmlwidgets")
devtools::install_github("ropensci/plotly@async")
devtools::install_github("rstudio/DT")

Contents

1. Why use promises?

Why do we need async programming? What is it good for, and not good for?

2. An informal intro to async programming

Async programming can require a serious mental shift, even for veteran programmers. This document attempts to introduce the “average” R user to the topic, as gently as possible.

3. Working with promises

A more thorough exploration of the concepts behind promises, and the API provided by the promises package.

4. Launching tasks

A guide to the future package, the place where we expect most async programming in R to begin.

5. Advance future and promises usage

Leverage promises to make sure that future execution does not block the main R process.

5. Using promises with Shiny

Learn how to integrate promises into your Shiny applications.

6. Combining promises

Functions and techniques for working with multiple promises simultaneously.

7. Case study: converting a Shiny app to async

Walk through the conversion of a realistic Shiny example app to async.