Skip to content

Tidyselect targets for tar_combine #35

Closed Answered by wlandau
riazarbi asked this question in Help
Discussion options

You must be logged in to vote

Target objects generated by tar_map() have names, so you could pre-filter the output of tar_map() and feed that to tar_combine().

Or, if you are not using tar_map(), you could write your testing targets in a separate list and feed that to tar_combine().

# _targets.R
library(targets)
library(tarchetypes)

other_targets <- list(
  tar_target(x, ...)
  tar_target(y,...)
  ...
)

testing_targets <- list(
  tar_target(a.test, ...)
  tar_target(b.test, ...)
)

testing_results <- tar_combine(results, testing_targets)

# Full list of targets:
list(
  other_targets,
  testing_targets,
  testing_results
)

Another option is to use dynamic branching because it automatically combines data frame return…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by riazarbi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants