-
Notifications
You must be signed in to change notification settings - Fork 129
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
Cross failing when called with previous targets #986
Comments
Wow, that's serious! Thanks for finding the bug! Should be fixed in bd7588e. |
Thanks for the quick fix, it seems to work. Ps is there an easy way to simplify target names, i notice with my code they seem to grow out of hand quite quickly (e.g. >100 characters). In the past I have written custom functions to avoid the inheritance of the name of the previews target to avoid to much duplication. Is this the best way or are there other solutions? |
Yes there is. Transformations have an library(drake)
drake_plan(
radar = target(
get_radar_info(x),
transform = map(x = c("a", "b"))
),
set = target(
get_data(year, month),
transform = cross(year = c(2015, 2016), month = c(9, 10))
),
cut = target(
some_crop_function(set, radar),
transform = cross(radar, set, .id = c(x, year, month))
)
)
#> # A tibble: 14 x 2
#> target command
#> <chr> <expr>
#> 1 radar_a get_radar_info("a")
#> 2 radar_b get_radar_info("b")
#> 3 set_2015_9 get_data(2015, 9)
#> 4 set_2016_9 get_data(2016, 9)
#> 5 set_2015_10 get_data(2015, 10)
#> 6 set_2016_10 get_data(2016, 10)
#> 7 cut_a_2015_9 some_crop_function(set_2015_9, radar_a)
#> 8 cut_b_2015_9 some_crop_function(set_2015_9, radar_b)
#> 9 cut_a_2016_9 some_crop_function(set_2016_9, radar_a)
#> 10 cut_b_2016_9 some_crop_function(set_2016_9, radar_b)
#> 11 cut_a_2015_10 some_crop_function(set_2015_10, radar_a)
#> 12 cut_b_2015_10 some_crop_function(set_2015_10, radar_b)
#> 13 cut_a_2016_10 some_crop_function(set_2016_10, radar_a)
#> 14 cut_b_2016_10 some_crop_function(set_2016_10, radar_b) Created on 2019-08-14 by the reprex package (v0.3.0) You can also set library(drake)
drake_plan(
radar = target(
get_radar_info(x),
transform = map(x = c("a", "b"), .id = FALSE)
),
set = target(
get_data(year, month),
transform = cross(year = c(2015, 2016), month = c(9, 10), .id = FALSE)
),
cut = target(
some_crop_function(set, radar),
transform = cross(radar, set, .id = FALSE)
)
)
#> # A tibble: 14 x 2
#> target command
#> <chr> <expr>
#> 1 radar get_radar_info("a")
#> 2 radar_2 get_radar_info("b")
#> 3 set get_data(2015, 9)
#> 4 set_2 get_data(2016, 9)
#> 5 set_3 get_data(2015, 10)
#> 6 set_4 get_data(2016, 10)
#> 7 cut some_crop_function(set, radar)
#> 8 cut_2 some_crop_function(set, radar_2)
#> 9 cut_3 some_crop_function(set_2, radar)
#> 10 cut_4 some_crop_function(set_2, radar_2)
#> 11 cut_5 some_crop_function(set_3, radar)
#> 12 cut_6 some_crop_function(set_3, radar_2)
#> 13 cut_7 some_crop_function(set_4, radar)
#> 14 cut_8 some_crop_function(set_4, radar_2) Created on 2019-08-14 by the reprex package (v0.3.0) |
Also (re #979) development |
Thanks that helps a lot to keep stuff manageable |
When I generate targets (in this case
dataCutPerMonth
) based on two other targets (dataSet
anddataRadar
) by crossing these two targets I seem to not get the right combinations. In this case I do not have any targets for radara
in month9
and radarb
in month10
. There seems to be a failure in crossing here.Created on 2019-08-13 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: