pattern and map using a list variable #342
Replies: 1 comment
-
|
# _targets.R
library(targets)
library(stantargets)
list(
tar_target(idxs, make_idxs_split(length(file_paths), 0.75, seed = tar_seed())),
tar_target(id_train, idxs$training),
tar_target(
training_set,
read_ecg(file_paths[id_train]),
pattern = map(id_train)
)
)If you think those input files are likely to change, consider tracking them so the relevant targets rerun when changes happen. This can be tricky with dynamic branching, but |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My problem here is the following:
I create a list with idxs for training and test set:
tar_target( idxs, make_idxs_split(length(file_paths), 0.75, seed = tar_seed()) )idxshasidxs$trainingandidxs$test.The following is not working:
it fails with
Error: invalid pattern: map(idxs$training)Digging, I see that the function
settings_validate_pattern()inclass_settings.Ris where it stops. This because the symbols$or[[or[are not recognized.I know that the members of a dynamic list cannot be validated beforehand. So this is a bug, or is there a proper way to do this?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions