This function writes a log of the aggregation process. It reports the input and output datasets, variables and settings used, distributions of aggregation variables, map projection, program start and end times, and any warnings that were generated.

writeGATlog(
  area = NULL,
  gatvars = NULL,
  aggvars = NULL,
  filevars = NULL,
  mysettings = NULL,
  mergevars = NULL,
  ratevars = NULL,
  exclist = NULL,
  settingsfile = NULL
)

Arguments

area

Spatial layer.

gatvars

List of objects created by GAT. See the example for the elements it contains.

aggvars

List of objects created by the aggregation process. See mergeGATpolygons() for the elements created.

filevars

List of file names and paths. Of relevance to this function are the filename, filein, and the combined save path and save name, userout.

mysettings

List of system settings, including version, pkgdate, starttime, and the booleans savekml and exists.

mergevars

List of settings for the aggregation. See the example for the elements it contains.

ratevars

List of settings for calculating rate. See the example for the elements it contains.

exclist

List of exclusion criteria to use when merging.

settingsfile

R data file (*.Rdata) produced as part of GAT's output. This file saves all settings for GAT. Other options can be set to NULL only if this option is defined.

Notes on using the settingsfile option:

  1. You will get an error if you moved the input shapefile before running the function with this option, since the function needs to access the input shapefile to recreate the log.

  2. Reading in an *.Rdata file from a previous version of GAT may result in incorrect elapsed time and GAT version numbers being written to the log, or in errors that cause the file to be incomplete, due to changes in settings saved to the *.Rdata file as GAT has evolved.

Examples


# if you run this example, it saves "my_hftown.log" to your working
# directory

if (interactive()) {
gatvars <- list(
  myidvar = "ID",             # character variable of unique values
  aggregator1 = "TOTAL_POP",  # numeric variable
  aggregator2 = "TOTAL_POP",  # numeric variable
  minvalue1 = 5000, minvalue2 = 5000,
  maxvalue1 = 16423, maxvalue2 = 15000,
  boundary = "COUNTY",        # character variable of non-unique values
  mergeopt1 = "closest",      # method used to merge polygons
  rigidbound = FALSE,         # boolean: were boundaries enforced?,
  savekml = FALSE,
  popwt = FALSE,
  exclmaxval = 2,
  ismax1 = TRUE,       # user selected "NONE" as maximum value
  ismin2 = FALSE,
  ismax2 = FALSE
)

mergevars <- list(
  mergeopt1 = "similar",    # can be similar, closest, or least
  similar1 = "AREAWATR",    # numeric variable
  similar2 = "AREALAND",    # numeric variable without any zeros
  centroid = "geographic"
)

ratevars <- list(
  ratename = "pop_density",
  numerator = "TOTAL_POP",
  denominator = "AREALAND",
  multiplier = 5000,
  colorname = "Blue-Green",
  colorscheme = "BuGn"
)

aggvars <- defineGATmerge(
  area = hftown,
  gatvars = gatvars,
  mergevars = mergevars
)

filevars <- list(
  filein = "hftown",                        # original filename
  userin = paste0(getwd(), "/hftown"),      # original file and path name
  userout = paste0(getwd(), "/my_hftown"),  # save file path and name
  pathout = getwd(),                        # save path name
  fileout = "my_hftown"                     # save file name
)

mysettings <- list(
  starttime = Sys.time(),
  version = "1.0",
  pkgdate = format(Sys.Date(), "%m-%d-%Y"),
  adjacent = TRUE,
  pwrepeat = FALSE,
  minfirst = TRUE,
  exists = FALSE
)

exclist <-
  list(
    var1 = "exclusion1",
    var2 = "exclusion2",
    var3 = "NONE",           # flag to denote no third variable
    math1 = "greater than",
    math2 = "less than",
    math3 = "equals",
    val1 = 5000,
    val2 = 50,
    val3 = 0,
    flagsum = 5
  )

writeGATlog(
  area = hftown,
  gatvars = gatvars,
  filevars = filevars,
  aggvars = aggvars,
  mysettings = mysettings,
  mergevars = mergevars,
  ratevars = ratevars,
  exclist = exclist
)
}