-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use tar_map()
to reduce duplicated code
#374
Comments
I tested this on a modified version from the documentation: list(
tarchetypes::tar_map(
list(a = c(12, 34, 1), b = c(45, 78, 9)),
targets::tar_target(x, a + b),
targets::tar_target(y, x + a, pattern = map(x))
)
) And the results show that the 'target factory' is accurate: This can be part of a wider refactor discussed, will do some tests first but I think we can greatly simplify things as per #343 but taking it to the next level. |
Taking a look at this now. |
FYI @mem48 this is how you iterate with targets
Heads-up @mem48 and @wangzhao0217 these are the regions I'm planning to use to geographically batch the build process, enabling all routes to be held in a single list: |
From the targets manual:
Just saw this tip from @andrewheiss (thanks for sharing):
Source: https://fosstodon.org/@[email protected]/111689215513772257
Currently our code has a lot of bits like this:
npt/_targets.R
Lines 322 to 328 in f1ae9eb
An iterator like
tar_map()
could compress those 3 targets into a single function call, reducing complexity and easing readability and maintenance.The text was updated successfully, but these errors were encountered: