-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from ropensci/tidy_eval
Support tidy evaluation (solve #200)
- Loading branch information
Showing
20 changed files
with
373 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,7 @@ prework | |
programmatically | ||
Programmatically | ||
PSOCK | ||
quasiquotation | ||
quickstart | ||
Quickstart | ||
RDS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
drake_context("tidy eval") | ||
|
||
# From Kendon Bell: https://github.com/ropensci/drake/issues/200 | ||
test_with_dir("drake_plan does tidy eval in `...` argument", { | ||
my_variable <- 5 | ||
plan1 <- drake_plan( | ||
a = !!my_variable, | ||
b = !!my_variable + 1, | ||
list = c(d = "!!my_variable") | ||
) | ||
plan2 <- data.frame( | ||
target = c("a", "b", "d"), | ||
command = c("5", "6", "!!my_variable"), | ||
stringsAsFactors = FALSE | ||
) | ||
expect_equal(plan1, plan2) | ||
}) | ||
|
||
# From Alex Axthelm: https://github.com/ropensci/drake/issues/200 | ||
test_with_dir("drake_plan tidy eval can be disabled", { | ||
plan1 <- drake_plan( | ||
a = !!my_variable, | ||
b = !!my_variable + 1, | ||
list = c(d = "!!my_variable"), | ||
tidy_evaluation = FALSE | ||
) | ||
plan2 <- data.frame( | ||
target = c("a", "b", "d"), | ||
command = c("!(!my_variable)", "!(!my_variable + 1)", "!!my_variable"), | ||
stringsAsFactors = FALSE | ||
) | ||
expect_equal(plan1, plan2) | ||
}) | ||
|
||
# From Kendon Bell: https://github.com/ropensci/drake/issues/200 | ||
test_with_dir("make() does tidy eval in commands", { | ||
con <- dbug() | ||
con$plan <- drake_plan(list = c( | ||
little_b = "\"b\"", | ||
letter = "!!little_b" | ||
)) | ||
con$targets <- con$plan$target | ||
testrun(con) | ||
expect_equal(readd(letter), "b") | ||
}) |
Oops, something went wrong.