-
Hello! I have a step in a targets plan where I want to combine vectors that are the result of branching. If How can I make this work? Thanks! targets::tar_dir({
targets::tar_script({
library(targets)
func_that_returns_vec <- function(param, name) {
c(
paste0(param, name, "first-item"),
paste0(param, name, "second-item")
)
}
list(
tar_target(x_params, c(1,2)),
tar_target(x_names, c("x-a","x-b")),
tar_target(y_params, c(3,4)),
tar_target(y_names, c("y-a","y-b")),
tar_target(
x_results,
func_that_returns_vec(x_params, x_names),
pattern = map(x_params, x_names),
),
tar_target(
y_results,
func_that_returns_vec(y_params, y_names),
pattern = map(y_params, y_names)
),
tar_target(
all_results,
c(x_results, y_results)
)
)
})
targets::tar_make()
})
#> ● run target y_names
#> ● run target y_params
#> ● run target x_params
#> ● run target x_names
#> ● run branch y_results_f7f07863
#> ● run branch y_results_1638369d
#> ● run branch x_results_6178c7d5
#> ● run branch x_results_a1bf677f
#> ● run target all_results
#> Error : Can't merge the outer name `x_results_6178c7d5` with a vector of length > 1.
#> Please supply a `.name_spec` specification.
#> Error: callr subprocess failed: Can't merge the outer name `x_results_6178c7d5` with a vector of length > 1.
#> Please supply a `.name_spec` specification. Created on 2021-02-20 by the reprex package (v1.0.0) Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.0.3 (2020-10-10)
#> os macOS Catalina 10.15.7
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Asia/Tokyo
#> date 2021-02-20
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0)
#> callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.2)
#> cli 2.3.0 2021-01-31 [1] CRAN (R 4.0.2)
#> codetools 0.2-18 2020-11-04 [1] CRAN (R 4.0.2)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.3)
#> data.table 1.13.6 2020-12-30 [1] CRAN (R 4.0.2)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.0)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.2)
#> igraph 1.2.6 2020-10-06 [1] CRAN (R 4.0.2)
#> knitr 1.31 2021-01-27 [1] CRAN (R 4.0.2)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.3)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
#> pillar 1.4.7 2020-11-20 [1] CRAN (R 4.0.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0)
#> processx 3.4.5 2020-11-30 [1] CRAN (R 4.0.2)
#> ps 1.5.0 2020-12-05 [1] CRAN (R 4.0.2)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
#> reprex 1.0.0 2021-01-27 [1] CRAN (R 4.0.2)
#> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.2)
#> rmarkdown 2.6 2020-12-14 [1] CRAN (R 4.0.2)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
#> targets 0.1.0 2021-02-01 [1] CRAN (R 4.0.2)
#> tibble 3.0.6 2021-01-29 [1] CRAN (R 4.0.2)
#> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.0)
#> vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.2)
#> withr 2.4.1 2021-01-26 [1] CRAN (R 4.0.2)
#> xfun 0.20 2021-01-06 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library |
Beta Was this translation helpful? Give feedback.
Answered by
wlandau
Feb 20, 2021
Replies: 2 comments 2 replies
-
Thanks for sharing, you found a bug. Should be fixed now. Please try 142708d. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
joelnitta
-
Thanks! Seems fixed in 598d7a2. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing, you found a bug. Should be fixed now. Please try 142708d.