passing input data frame to exec
ggrothendieck opened this issue · 1 comments
ggrothendieck commented
How is it that the first of these works but not the rest?
library (dplyr)
# ...snip...
library (purrr)
BOD %>% mutate(sum = exec(pmin, !!!.)) # works
## Time demand sum
## 1 1 8.3 1
## 2 2 10.3 2
## 3 3 19.0 3
## 4 4 16.0 4
## 5 5 15.6 5
## 6 7 19.8 7
BOD %>% mutate(sum = exec(pmin, !!!pick(everything())))
## Error in `pick()`:
## ! Must only be used inside data-masking verbs like `mutate()`, `filter()`, and `group_by()`.
## Run `rlang::last_trace()` to see where the error occurred.
BOD %>% mutate(sum = exec(pmin, !!!cur_data()))
## Error in `cur_data()`:
## ! Must only be used inside data-masking verbs like `mutate()`, `filter()`, and `group_by()`.
## Run `rlang::last_trace()` to see where the error occurred.
## Warning message:
## `cur_data()` was deprecated in dplyr 1.1.0.
## ℹ Please use `pick()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
BOD %>% mutate(sum = exec(pmin, !!!.data))
## Error in `mutate()`:
## ℹ In argument: `sum = exec(pmin)`.
## Caused by error:
## ! no arguments
## Run `rlang::last_trace()` to see where the error occurred.
hadley commented
Because !!!
evaluated by mutate()
— I think that will be a bit easier to see if you look at the tracebacks.