-
Help
DescriptionI posted the following question on stackoverflow. I don't know the etiquette of this discussion page, I hope it is alright to ask again. I have searched the targets manual and existing issues, the discussion pages, and SO but did not find an answer. My specific problem has been solved through looping manually over the branches to find the problematic file but I'm trying to get better at debugging targets so I'm very interested in the answer. I have a targets pipeline where a first target looks in a directory for data files and a second one uses dynamic branching to read and format it. library(targets)
read <- function(file){
f <- read.csv(file)
f$date <- format.Date(f$date)
return(f)
}
list(
tar_target(files, dir(data, pattern = ".csv")),
tar_target(my_target, read(files), pattern = files)
) Now one of the targets throws an error: ✖ errored branch my_target_ec58af61779dfe2e
...
── Last error message ──────────────────────────────────────────
do not know how to convert 'x' to class “POSIXct” I understand that one data file has a format error that I need to correct. But how do I know what data file this branch uses? To clarify, I am looking for a function tar_document_branches(my_target)
branch code_run
my_target_4ds5z78dq6qs45ds read(data/file1.csv)
my_target_ec58af61779dfe2e read(data/file2.csv) So that I know that the error is in file2.csv |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can the workspace to find out to the upstream data the branch was using: https://books.ropensci.org/targets/debugging.html#workspaces. In recent versions of |
Beta Was this translation helpful? Give feedback.
You can the workspace to find out to the upstream data the branch was using: https://books.ropensci.org/targets/debugging.html#workspaces. In recent versions of
targets
, every errored target automatically saves a workspace.