readd_by_country: Read a subtarget based on country

View source: R/utility_functions.R

readd_by_countryR Documentation

Read a subtarget based on country

Description

It is sometimes convenient to read a target out of the drake cache by country (or countries). Technically, this process involves reading a sub-target, because the plans created by get_plan() are all mapped by country. But subtargets are extracted based on country index in the cache rather than country name, and it is cumbersome to keep track of cache indices for countries. This function de-references the indices based on the value of country and extracts the correct subtarget.

Usage

readd_by_country(
  target,
  country,
  alloc_and_eff_couns_trgt = PFUWorkflow::target_names$alloc_and_eff_couns,
  cache_path = PFUWorkflow::cache_info$cache_path
)

Arguments

target

The name of the drake target as a string. See get_plan() for names of targets.

country

The 3-letter ISO abbreviation (a string) of the country (or vector of 3-letter countries) for whom target is to be readd from the drake cache.

alloc_and_eff_couns_trgt

See PFUWorkflow::target_names.

cache_path

See PFUWorkflow::cache_info.

Value

the country-specific version of target


MatthewHeun/SEAPSUTWorkflow documentation built on April 22, 2022, 2:21 p.m.