Closed matthiasgomolka closed 3 years ago
id_chr()
allows you to get the name of the sub-target while make()
or r_make()
is running. That should allow you to name files in a way that matches your targets. Another alternative is to generate a universally unique identifier (UUID) with the uuid
package or tempfile()
.
Prework
Question
I use dynamic targets in my plan. One of those targets writes files to disk. So I get one file per subtarget. Now I need to make sure that these files have distinguishible names. It would be nice if I could somehow get the cryptic name of the subtarget, since this would make it easy to bring the subtargets and the files written to disk together.
I played around with timestampts but this is not safe as it sometimes happens that two subtargets try to create a file at the same moment.
I suppose, this information is "somewhere". Is it also accessible within a dynamic target?
Reproducible example
Does not apply here.