Skip to content

[help] Dynamically link functions used in a do.call() as dependencies for target branches #1344

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

You must be logged in to vote

It's tricky to dynamically branch over functions such that a change to one parser function does not invalidate all the branches of parsed_files. It's not elegant, but I think it will work if the actual function body becomes part of parser_xwalk, as opposed to the function name. Since functions can have brittle internals that change hashes unpredictably, the following sketch deparses them to text. This could lose information in the function closure injected by Vectorize(), purrr::safely(), etc., but it might work in your case if your parsers are simple enough.

tar_option_set()

parsers <- list(
  parser_typeA = function(in_file) readRDS(in_file)[4,],
  parser_typeB = function(in_file) read…

Replies: 2 comments 4 replies

Comment options

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

Comment options

You must be logged in to vote
3 replies
@lindsayplatt
Comment options

@lindsayplatt
Comment options

@lindsayplatt
Comment options

Answer selected by lindsayplatt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants