Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show how targets were expanded with wildcards #461

Merged
merged 5 commits into from
Jul 6, 2018
Merged

Show how targets were expanded with wildcards #461

merged 5 commits into from
Jul 6, 2018

Conversation

wlandau
Copy link
Member

@wlandau wlandau commented Jul 6, 2018

Summary

  1. Implement a trace argument to evaluate_plan() to optionally add indicator columns to show which targets got expanded/evaluated with which wildcard values.
  2. Rename the always_rename argument to rename in evaluate_plan().
  3. Add a rename argument to expand_plan().
  4. Clean up the internals of wildcard templating.

(1) solves #376 because it allows easier custom filtering for later gathering. @tmastny, I know this is not quite what you asked for, but it makes custom gathering easier while preserving the flexibility and design patterns of drake.

library(drake)
plan <- drake_plan(x = rnorm(1e3, mean = custom__), y = rt(1e3, df = 5))
eval <- evaluate_plan(plan, wildcard = "custom__", values = 1:2, trace = TRUE)
gather_plan(eval[!is.na(eval$custom__), ], gather = "c")
#> # A tibble: 1 x 2
#>   target command                
#>   <chr>  <chr>                  
#> 1 target c(x_1 = x_1, x_2 = x_2)

(1) also opens up new visualization possibilities because it provides natural groupings for targets.

Related GitHub issues

Checklist

  • I have read drake's code of conduct, and I agree to follow its rules.
  • I have read the guidelines for contributing.
  • I have listed any substantial changes in the development news.
  • I have added testthat unit tests to tests/testthat to confirm that any new features or functionality work correctly.
  • I have tested this pull request locally with devtools::check()
  • This pull request is ready for review.
  • I think this pull request is ready to merge.

@wlandau wlandau self-assigned this Jul 6, 2018
Keep track of wildcard columns in a plan.
@codecov-io
Copy link

codecov-io commented Jul 6, 2018

Codecov Report

Merging #461 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #461   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          66     66           
  Lines        5475   5485   +10     
=====================================
+ Hits         5475   5485   +10
Impacted Files Coverage Δ
R/check.R 100% <100%> (ø) ⬆️
R/sanitize.R 100% <100%> (ø) ⬆️
R/generate.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22f0917...2c52f54. Read the comment docs.

@lintr-bot
Copy link

tests/testthat/test-generate.R:402:1: style: Trailing whitespace is superfluous.

^~

@wlandau wlandau merged commit 582379b into master Jul 6, 2018
@wlandau wlandau deleted the i376 branch July 6, 2018 12:45
@wlandau wlandau restored the i376 branch July 7, 2018 15:46
@wlandau wlandau deleted the i376 branch July 8, 2018 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants