Skip to content

[help] How can I easlily create subtargets using map or tar_map? #1359

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

You must be logged in to vote

To create that branching structure in the graph, you can use static branching. Please have a look at https://books.ropensci.org/targets/static.html. Example:

library(targets)
library(tarchetypes)

list(
  tar_target(
    name = main_target,
    command = "main_target"
  ),
  tar_map(
    tar_target(
      name = subtarget,
      command = paste(main_target, static_branch)
    ),
    values = list(static_branch = c("static_branch_1", "static_branch_2")),
    descriptions = NULL
  )
)

There is also dynamic branching, documented at https://books.ropensci.org/targets/dynamic.html

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@filipemsc
Comment options

Answer selected by filipemsc
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