drake (version 7.3.0)

drake_envir: Get the environment where drake builds targets

Description

Call this function inside the commands in your plan to get the environment where drake builds targets. That way, you can strategically remove targets from memory while make() is running. That way, you can limit the amount of computer memory you use.

Usage

drake_envir()

Arguments

Value

The environment where drake builds targets.

See Also

from_plan()

Examples

Run this code
# NOT RUN {
plan <- drake_plan(
  large_data_1 = sample.int(1e4),
  large_data_2 = sample.int(1e4),
  subset = c(large_data_1[seq_len(10)], large_data_2[seq_len(10)]),
  summary = {
    print(ls(envir = drake_envir()))
    # We don't need the large_data_* targets in memory anymore.
    rm(large_data_1, large_data_2, envir = drake_envir())
    print(ls(envir = drake_envir()))
    mean(subset)
  }
)
make(plan, cache = storr::storr_environment(), session_info = FALSE)
# }

Run the code above in your browser using DataLab