Skip to content

Instantly share code, notes, and snippets.

@MilesMcBain
Last active June 19, 2020 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MilesMcBain/d7653e6e36b2a162605606fa2894b876 to your computer and use it in GitHub Desktop.
Save MilesMcBain/d7653e6e36b2a162605606fa2894b876 to your computer and use it in GitHub Desktop.
deps_target_recursive
deps_target_recursive <- function(target, plan){
deps <- deps_target(target, plan = plan, character_only = TRUE)
target_itr <- function(deps, all_deps){
new_deps <-
purrr::map_dfr(.x = deps$name,
.f = ~ drake:::deps_target_impl(.x, drake:::drake_config2(plan), character_only = TRUE)) %>%
distinct()
if(nrow(new_deps) == 0) all_deps
else target_itr(new_deps, bind_rows(all_deps, new_deps))
}
target_itr(deps, tibble(name = character(0), type = character(0), hash = character(0)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment