-
Help
DescriptionI need to combine and process data efficiently due to memory constraints. Basically I want to run 80 queries to get GIS data (20 locations over 4 date ranges). I have the targets for that, and to process the downloaded data per iteration. But I need to group the data per location, and passing in the previously mapped targets still has 80 branches. The data is too big to read it all into one target and split it out. list( ** so now I have a 80 branches each with a ton of data. ** tar_target(summarise, gis_data %>% group_by(location) %>% summarise(count = sum(something)), [WHAT_TO_PUT_HERE] ** now I'm expecting 20 branches each with the summary of it's dates ** ) ) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You could statically branch over locations and dynamically branch over factors within location, similar to https://books.ropensci.org/targets/static.html#dynamic-within-static-branching. That way, groupings automatically happen within location. Here is a sketch that covers the structure of the pipeline, even if it doesn't have the GIS details: # _targets.R file
library(targets)
library(tarchetypes)
list(
tar_map(
values = list(location = c(0.3, 0.4)),
tar_target(from, c(10, 20)),
tar_target(gis_data, rbinom(from, 1, location), pattern = map(from)),
tar_target(summaries, data.frame(count = sum(gis_data)))
)
) tar_visnetwork() tar_make(reporter = "silent")
tar_read(summaries_0.3)
#> count
#> 1 8
tar_read(summaries_0.4)
#> count
#> 1 12 |
Beta Was this translation helpful? Give feedback.
-
Can I pull the values from an existing target?
|
Beta Was this translation helpful? Give feedback.
You could statically branch over locations and dynamically branch over factors within location, similar to https://books.ropensci.org/targets/static.html#dynamic-within-static-branching. That way, groupings automatically happen within location. Here is a sketch that covers the structure of the pipeline, even if it doesn't have the GIS details: