mapAnalysis: Generic analysis for map objects

View source: R/map-analysis.R

mapAnalysisR Documentation

Generic analysis for map objects

Description

This is the workhorse function that runs any analyses described in map@analyses. It uses hashing, and will not rerun any analysis that already ran on identical inputs.

Usage

mapAnalysis(
  map,
  functionName = NULL,
  purgeAnalyses = NULL,
  useParallel = getOption("map.useParallel", FALSE),
  ...
)

Arguments

map

Optional map object. If not provided, then one will be created. If provided, then the present object or options passed to prepInputs e.g., url, will be appended to this map.

functionName

A function name that will be run on combinations of inputs in the map object. See details.

purgeAnalyses

A character string indicating which analysis group combination or part thereof (e.g., the name entered into the row under analysisGroup2 column of the map@metadata or a functionName.

useParallel

Logical. If TRUE, then if there is more than one calculation to do at any stage, it will create and use a parallel cluster via makeOptimalCluster

...

Additonal arguments passed to reproducible::postProcess(), reproducible::projectInputs(), reproducible::fixErrors(), and reproducible::prepInputs().

Details

This function will do a sequence of things. First, it will run expand.grid on any columns whose names start with analysisGroup, creating a factorial set of analyses as described by these columns. It will assess the combinations against the arguments used by the functionName. For any analysisGroup that does not provide the correct arguments for the functionName, these analysisGroups will be omitted for that particular function. For efficiency, the function will then assess if any of these has already been run. For those that have not been run, it will then run the functionName on arguments that it finds in the metadata slot of the map obj, as well as any arguments passed in here in the .... In general, the arguments being passed in here should be fixed across all analyses, while any that vary by analysis should be entered into the metadata table at the time of adding the layer to the map, via mapAdd.


PredictiveEcology/map documentation built on Nov. 11, 2023, 11:44 a.m.