Skip to content

[help] How to Efficiently Combine and Save Large Dataframes #1288

Closed Answered by wlandau
grobins asked this question in Help
Discussion options

You must be logged in to vote

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(summ…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@grobins
Comment options

Answer selected by grobins
Comment options

You must be logged in to vote
1 reply
@wlandau
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants