S4 classes and functions #910
Replies: 2 comments 3 replies
-
I recommend using a simpler data structure for configuration details, one that does not contain functions. Better yet, you could split these configuration details into different objects so not all targets rerun when one configuration element is changed. https://books.ropensci.org/targets/projects.html#multiple-projects could help manage multiple versions of a project. Related: #887, ropensci/drake#345 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the tips. The targets package is growing faster than I can keep up with it - I swear I haven't seen the projects functionality before! :-) But that's a good thing. |
Beta Was this translation helpful? Give feedback.
-
Hi,
My pipeline uses an S4 class to store all the various configuration options necessary for the particular version of the analysis - each target in the pipeline gets this object as an argument. The entire pipeline can then be easily reconfigured for a different setup (e.g. data source etc)
The problem is that one of the slots in my S4 class is a function. Even though the source code is identical when I create the S4 object, the environment that is associated with the function can change from time to time. e.g.
where
x
andy
are two different versions of the configuration object. Note the "environment" argument at the end - this is what is changing from time to time, and triggering (unnecessarily) the rest of the pipeline (I think!)Is there anything I can do to get targets to ignore such minor changes?
Beta Was this translation helpful? Give feedback.
All reactions