Skip to content

Understanding tar_cancel with dynamic branching #519

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

You must be logged in to vote

In your case, instead of tar_cancel(), I recommend returning a NULL value early.

summ <- function(dataset) {
  if("A" %in% dataset$z) return()
  summarize(dataset, mean_x = mean(x))
}

Then, the code in downstream dynamic targets could be written to handle NULL branches.

tar_cancel() makes no attempt to ensure that a target's value exists, and it makes no attempt to modify downstream dynamic branching behavior. I still like this limited scope because it is not likely to surprise users (surprises more often come from trying to do too much than too little) or create reproducibility problems far downstream. It also avoids a serious redesign on my end for the sake of a feature that would not …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@wlandau
Comment options

@robitalec
Comment options

@robitalec
Comment options

@robitalec
Comment options

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