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

Trace as many attributes as possible when combining #1008

Closed
bart1 opened this issue Sep 12, 2019 · 2 comments
Closed

Trace as many attributes as possible when combining #1008

bart1 opened this issue Sep 12, 2019 · 2 comments

Comments

@bart1
Copy link

bart1 commented Sep 12, 2019

Currently when using a combine transformation all attributes except for the target attributes get omitted. I think if it it not to hard to implement it would be great to retain those attributes that remain valid. There is currently a work around by adding those attributes to the .by arguments to combine call (second example below) but i think it could be desirable to trace these atributes by default. Thanks in advance for the great work.

require(drake)
#> Loading required package: drake
drake_plan(
  i=target(p,transform=map(p=!!(1:2))),
  a=target(x*i, transform=cross(i,x=!!(1:2))),
  b=target(a*y, transform=cross(a,y=!!(1:2),.id=c(p,x))),
  d=target(c(b), transform=combine(b, .by=c(a))),
  trace = T
)
#> # A tibble: 18 x 9
#>    target    command        p     i     x     a       y     b       d      
#>    <chr>     <expr>         <chr> <chr> <chr> <chr>   <chr> <chr>   <chr>  
#>  1 i_1L      1L           … 1L    i_1L  <NA>  <NA>    <NA>  <NA>    <NA>   
#>  2 i_2L      2L           … 2L    i_2L  <NA>  <NA>    <NA>  <NA>    <NA>   
#>  3 a_1L_i_1L 1L * i_1L    … 1L    i_1L  1L    a_1L_i… <NA>  <NA>    <NA>   
#>  4 a_2L_i_1L 2L * i_1L    … 1L    i_1L  2L    a_2L_i… <NA>  <NA>    <NA>   
#>  5 a_1L_i_2L 1L * i_2L    … 2L    i_2L  1L    a_1L_i… <NA>  <NA>    <NA>   
#>  6 a_2L_i_2L 2L * i_2L    … 2L    i_2L  2L    a_2L_i… <NA>  <NA>    <NA>   
#>  7 b_1L_1L   a_1L_i_1L * 1… 1L    i_1L  1L    a_1L_i… 1L    b_1L_1L <NA>   
#>  8 b_1L_1L_2 a_1L_i_1L * 2… 1L    i_1L  1L    a_1L_i… 2L    b_1L_1… <NA>   
#>  9 b_1L_2L   a_2L_i_1L * 1… 1L    i_1L  2L    a_2L_i… 1L    b_1L_2L <NA>   
#> 10 b_1L_2L_2 a_2L_i_1L * 2… 1L    i_1L  2L    a_2L_i… 2L    b_1L_2… <NA>   
#> 11 b_2L_1L   a_1L_i_2L * 1… 2L    i_2L  1L    a_1L_i… 1L    b_2L_1L <NA>   
#> 12 b_2L_1L_2 a_1L_i_2L * 2… 2L    i_2L  1L    a_1L_i… 2L    b_2L_1… <NA>   
#> 13 b_2L_2L   a_2L_i_2L * 1… 2L    i_2L  2L    a_2L_i… 1L    b_2L_2L <NA>   
#> 14 b_2L_2L_2 a_2L_i_2L * 2… 2L    i_2L  2L    a_2L_i… 2L    b_2L_2… <NA>   
#> 15 d_a_1L_i… c(b_1L_1L, b_… <NA>  <NA>  <NA>  a_1L_i… <NA>  <NA>    d_a_1L…
#> 16 d_a_1L_i… c(b_2L_1L, b_… <NA>  <NA>  <NA>  a_1L_i… <NA>  <NA>    d_a_1L…
#> 17 d_a_2L_i… c(b_1L_2L, b_… <NA>  <NA>  <NA>  a_2L_i… <NA>  <NA>    d_a_2L…
#> 18 d_a_2L_i… c(b_2L_2L, b_… <NA>  <NA>  <NA>  a_2L_i… <NA>  <NA>    d_a_2L…
drake_plan(
  i=target(p,transform=map(p=!!(1:2))),
  a=target(x*i, transform=cross(i,x=!!(1:2))),
  b=target(a*y, transform=cross(a,y=!!(1:2),.id=c(p,x))),
  d=target(c(b), transform=combine(b, .by=c(a,x,i,p))),
  trace = T
)
#> # A tibble: 18 x 9
#>    target      command      p     i     x     a      y     b      d        
#>    <chr>       <expr>       <chr> <chr> <chr> <chr>  <chr> <chr>  <chr>    
#>  1 i_1L        1L         … 1L    i_1L  <NA>  <NA>   <NA>  <NA>   <NA>     
#>  2 i_2L        2L         … 2L    i_2L  <NA>  <NA>   <NA>  <NA>   <NA>     
#>  3 a_1L_i_1L   1L * i_1L  … 1L    i_1L  1L    a_1L_… <NA>  <NA>   <NA>     
#>  4 a_2L_i_1L   2L * i_1L  … 1L    i_1L  2L    a_2L_… <NA>  <NA>   <NA>     
#>  5 a_1L_i_2L   1L * i_2L  … 2L    i_2L  1L    a_1L_… <NA>  <NA>   <NA>     
#>  6 a_2L_i_2L   2L * i_2L  … 2L    i_2L  2L    a_2L_… <NA>  <NA>   <NA>     
#>  7 b_1L_1L     a_1L_i_1L *… 1L    i_1L  1L    a_1L_… 1L    b_1L_… <NA>     
#>  8 b_1L_1L_2   a_1L_i_1L *… 1L    i_1L  1L    a_1L_… 2L    b_1L_… <NA>     
#>  9 b_1L_2L     a_2L_i_1L *… 1L    i_1L  2L    a_2L_… 1L    b_1L_… <NA>     
#> 10 b_1L_2L_2   a_2L_i_1L *… 1L    i_1L  2L    a_2L_… 2L    b_1L_… <NA>     
#> 11 b_2L_1L     a_1L_i_2L *… 2L    i_2L  1L    a_1L_… 1L    b_2L_… <NA>     
#> 12 b_2L_1L_2   a_1L_i_2L *… 2L    i_2L  1L    a_1L_… 2L    b_2L_… <NA>     
#> 13 b_2L_2L     a_2L_i_2L *… 2L    i_2L  2L    a_2L_… 1L    b_2L_… <NA>     
#> 14 b_2L_2L_2   a_2L_i_2L *… 2L    i_2L  2L    a_2L_… 2L    b_2L_… <NA>     
#> 15 d_a_1L_i_1… c(b_1L_1L, … 1L    i_1L  1L    a_1L_… <NA>  <NA>   d_a_1L_i…
#> 16 d_a_2L_i_1… c(b_1L_2L, … 1L    i_1L  2L    a_2L_… <NA>  <NA>   d_a_2L_i…
#> 17 d_a_1L_i_2… c(b_2L_1L, … 2L    i_2L  1L    a_1L_… <NA>  <NA>   d_a_1L_i…
#> 18 d_a_2L_i_2… c(b_2L_2L, … 2L    i_2L  2L    a_2L_… <NA>  <NA>   d_a_2L_i…

Created on 2019-09-12 by the reprex package (v0.3.0)

@wlandau
Copy link
Collaborator

wlandau commented Sep 12, 2019

Seems like an easier problem than provenance in map() and cross(). If there is a quick fix, it will probably be here.

@wlandau
Copy link
Collaborator

wlandau commented Sep 13, 2019

It took a little work, but drake now keeps non-missing singleton grouping variables within each combine() split.

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

No branches or pull requests

2 participants