Skip to content

wlandau/drake-examples

Repository files navigation

Launch Rstudio Binder

Consider targets

superseded lifecycle

drake is superseded. The targets R package is the long-term successor of drake, and it is more robust and easier to use. Please visit https://books.ropensci.org/targets/drake.html for full context and advice on transitioning.

drake examples

This repository is part of a community effort to collect, curate, and share publicly available examples of data analysis projects powered by the drake R package. Each folder is its own example with a self-sufficient set of code and data files.

Run in a browser

Click this badge to open the examples in RStudio through your browser: Launch Rstudio Binder

Run locally

You can download example files and run them locally with drake itself.

# Install and load drake.
devtools::install_github("ropensci/drake")
library(drake)
# List the available examples.
drake_examples()
# Get an example
drake_example("main")
list.files() # See the new 'main' folder

Contributing

Please read the top-level CONTRIBUTING.md and CONDUCT.md for rules and instructions.

Introductory examples

  • customer-churn: based on an RStudio Solutions Engineering example of how to use Keras with R. The motivation comes from a blog post by Matt Dancho, and the code is based on a notebook by Edgar Ruiz.
  • stan: validating a small Bayesian hierarchical model with rstan.
  • main: drake's main bare-bones introductory example, originally written by Kirill Müller and modified by Will Landau. Now based on R's built-in airquality dataset.
  • gsp: A concrete example using real econometrics data. It explores the relationships between gross state product and other quantities, and it shows off drake's ability to generate lots of reproducibly-tracked tasks with ease.
  • packages: A concrete example using data on R package downloads. It demonstrates how drake can refresh a project based on new incoming data without restarting everything from scratch.
  • mtcars: An old legacy example with the mtcars dataset. Use load_mtcars_example() to set up the project in your workspace.

High-performance computing examples

  • mlr-slurm: an example machine learning workflow rigged to deploy to a SLURM cluster.
  • Docker-psock: demonstrates how to deploy targets to a Docker container using a specialized PSOCK cluster.
  • sge: uses drake's high-performance computing functionality to send work to a Grid Engine cluster.
  • slurm: similar to sge, but for SLURM.
  • torque: similar to sge, but for TORQUE.

Example for developing drake

  • hpc-profiling: an example with a small number of medium-ish-sized datasets. The goal is to assess how long it takes (relatively speaking) to shuffle data around hpc workers.
  • overhead: an example explicitly designed to maximize strain on drake's internals. The purpose is to support profiling studies to speed up drake.

Demonstrations of specific features

  • script-based-workflows: demonstrates how to adapt drake to an imperative script-based project.
  • code_to_plan: questioning. Refer to script-based-workflows instead.

Real-world examples outside this repo

The official rOpenSci use cases and associated discussion threads describe applications of drake in action. Here are some more real-world sightings of drake in the wild.