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

Accept targets as inputs to cross #861

Closed
2 tasks done
vkehayas opened this issue May 6, 2019 · 1 comment
Closed
2 tasks done

Accept targets as inputs to cross #861

vkehayas opened this issue May 6, 2019 · 1 comment

Comments

@vkehayas
Copy link
Contributor

vkehayas commented May 6, 2019

Prework

Description

Hi,

Thanks for this lifesaver of a package!
I am a long-time user trying to catch-up with the new way of creating large plans.
This is a minimal example of what I would like to do:

library(drake)

dPlan = drake_plan(
  kMu = c(0, 1, 10),
  kSD = c(1, 2, 3),
  x = target(rnorm(n = 1000, 
                   mean = mean_val, 
                   sd = sd_val),
             transform = cross(mean_val = kMu,
                               sd_val = kSD))
)

And I would expect it to expand to

> dPlan
# A tibble: 9 x 2
  target command                             
  <chr>  <expr>                              
1 x_0_1  "rnorm(n = 1000, mean = 0, sd = 1) "
2 x_1_1  "rnorm(n = 1000, mean = 1, sd = 1) "
3 x_10_1 rnorm(n = 1000, mean = 10, sd = 1)  
4 x_0_2  "rnorm(n = 1000, mean = 0, sd = 2) "
5 x_1_2  "rnorm(n = 1000, mean = 1, sd = 2) "
6 x_10_2 rnorm(n = 1000, mean = 10, sd = 2)  
7 x_0_3  "rnorm(n = 1000, mean = 0, sd = 3) "
8 x_1_3  "rnorm(n = 1000, mean = 1, sd = 3) "
9 x_10_3 rnorm(n = 1000, mean = 10, sd = 3)  

which I can produce if I move kMu, kSD outside of drake's control and use !!. But in my real plan these would be variables that are being used to build other targets as well and I would like them to trigger building the first plan whenever they change. Is this an abuse of drake or is there a way to achieve what I want?

Apologies if there was a pre-existing issue I missed or if the answer relies on knowledge of the tidyverse (of which I have close to none).

@wlandau
Copy link
Member

wlandau commented May 6, 2019

Definitely a good question. This is currently not supported in drake. It is by far the most challenging feature request, and there are long-term plans to try. See #685 for the main thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants