You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm hoping to try and track changes to user-defined functions do not create targets, but are used in a notebook that is part of a pipeline. For example, I have a quick plotting function that I use repeatedly, but I do not want to have to create a target for every single plot in a notebook as this would clutter the _target.R file. However, if I made a change to that function, even if it is sourced into the notebook, the pipeline thinks it is up to date.
I believe this is different to issues #241 and #239 as these relate to packages, not standalone functions.
One thought I had was to write these functions in a separate R file that I can track using format = "file" like below, and this seems to work, but I just wanted to make sure this is a reasonable thing to do and wouldn't lead to unintended consequences.
One thought I had was to write these functions in a separate R file that I can track using format = "file" like below, and this seems to work, but I just wanted to make sure this is a reasonable thing to do and wouldn't lead to unintended consequences.
Sounds like a great workaround to me.
Another approach is to define a target for all the function objects:
This technique is less trigger-happy than format = "file" because it does not invalidate the target if there are trivial changes to comments and whitespace. For a function in memory, targets cannot tell the difference between this:
Prework
Question
I'm hoping to try and track changes to user-defined functions do not create targets, but are used in a notebook that is part of a pipeline. For example, I have a quick plotting function that I use repeatedly, but I do not want to have to create a target for every single plot in a notebook as this would clutter the
_target.R
file. However, if I made a change to that function, even if it is sourced into the notebook, the pipeline thinks it is up to date.I believe this is different to issues #241 and #239 as these relate to packages, not standalone functions.
One thought I had was to write these functions in a separate R file that I can track using
format = "file"
like below, and this seems to work, but I just wanted to make sure this is a reasonable thing to do and wouldn't lead to unintended consequences.In
_targets.R
:In my
user-defined-functions.R
file:In my
Rmd
notebook:Created on 2021-01-06 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: