Learn R Programming

drake (version 3.0.0)

make: Function make

Description

Run your project (build the targets).

Usage

make(plan, targets = drake::possible_targets(plan), envir = parent.frame(),
  verbose = TRUE, parallelism = drake::default_parallelism(), jobs = 1,
  packages = (.packages()), prework = character(0),
  prepend = character(0), command = "make",
  args = drake::default_system2_args(jobs = jobs, verbose = verbose))

Arguments

plan

workflow plan data frame. A workflow plan data frame is a data frame with a target column and a command column. Targets are the objects and files that drake generates, and commands are the pieces of R code that produce them. Use the function plan() to generate workflow plan data frames easily, and see functions analyses(), summaries(), evaluate(), expand(), and gather() for easy ways to generate large workflow plan data frames.

targets

character string, names of targets to build. Dependencies are built too.

envir

environment to use. Defaults to the current workspace, so you should not need to worry about this most of the time. A deep copy of envir is made, so you don't need to worry about your workspace being modified by make. The deep copy inherits from the global environment. Wherever necessary, objects and functions are imported from envir and the global environment and then reproducibly tracked as dependencies.

verbose

logical, whether to print progress to the console. Skipped objects are not printed.

parallelism

character, type of parallelism to use. See parallelism_choices() for the choices for this argument, and run ?parallelism_choices for an explanation of each. To use parallelism at all, be sure that jobs >= 2. If parallelism is "mclapply", drake will use parallel::mclapply() to distribute targets across parallel processes wherever possible. (This is not possible on Windows.) Setting parallelism to "parLapply" is similar, except that it uses parallel::parLapply(). It works on Windows, but it requires more overhead (except if jobs == 1, in which case no "cluster" is created). If "Makefile", drake will write and execute a Makefile to distribute targets across separate R sessions. The vignettes (vignette(package = "drake")) show how to turn those R sessions into separate jobs on a cluster. Read the vignettes to learn how to take advantage of multiple nodes on a supercomputer. WARNING: the Makefile is NOT standalone. Do not run outside of make(). For parallelism == "Makefile", Windows users will need to download and install Rtools.

jobs

number of parallel processes or jobs to run. Windows users should not set jobs > 1 if parallelism is "mclapply" because mclapply() is based on forking. Windows users who use parallelism == "Makefile" will need to download and install Rtools.

packages

character vector packages to load, in the order they should be loaded. Defaults to (.packages()), so you shouldn't usually need to set this manually. Just call library() to load your packages before make(). However, sometimes packages need to be strictly forced to load in a certian order, especially if parallelism is "Makefile". To do this, do not use library() or require() or loadNamespace() or attachNamespace() to load any libraries beforehand. Just list your packages in the packages argument in the order you want them to be loaded. If parallelism is "mclapply", the necessary packages are loaded once before any targets are built. If parallelism is "Makefile", the necessary packages are loaded once on initialization and then once again for each target right before that target is built.

prework

character vector of lines of code to run before build time. This code can be used to load packages, set options, etc., although the packages in the packages argument are loaded before any prework is done. If parallelism is "mclapply", the prework is run once before any targets are built. If parallelism is "Makefile", the prework is run once on initialization and then once again for each target right before that target is built.

prepend

lines to prepend to the Makefile if parallelism is "Makefile". See the vignettes (vignette(package = "drake")) to learn how to use prepend to take advantage of multiple nodes of a supercomputer.

command

character scalar, command to call the Makefile generated for distributed computing. Only applies when parallelism is "Makefile". Defaults to the usual "make", but it could also be "lsmake" on supporting systems, for example. command and args are executed via system2(command, args) to run the Makefile. If args has something like "--jobs=2", or if jobs >= 2 and args is left alone, targets will be distributed over independent parallel R sessions wherever possible.

args

command line arguments to call the Makefile for distributed computing. For advanced users only. If set, jobs and verbose are overwritten as they apply to the Makefile. command and args are executed via system2(command, args) to run the Makefile. If args has something like "--jobs=2", or if jobs >= 2 and args is left alone, targets will be distributed over independent parallel R sessions wherever possible.