Skip to contents

Calculates PRIO-GRID variables based on current pgoptions and saves them to disk. Each variable is computed by calling its corresponding gen_*() function and saved as an .rds file in the custom data folder.

Usage

calc_pg(varnames = NULL, overwrite = FALSE)

Arguments

varnames

Character vector with variable names from pgvariables. If NULL (default), calculates all available variables.

overwrite

Logical. If FALSE (default), skips variables that already exist in the output folder. If TRUE, recalculates all specified variables.

Value

NULL (invisibly). Called for side effects (saving files).

Examples

if (FALSE) { # \dontrun{
  # Calculate single variable
  calc_pg("ne_disputed_area_share")
  r <- load_pgvariable("ne_disputed_area_share")

  # Calculate all variables
  calc_pg()

  # Recalculate existing variables
  calc_pg(overwrite = TRUE)
} # }