readBardCheckpoint {BARD}R Documentation

Write checkpoint of BARD state, read checkpoint and restart.

Description

This checkpoints the BARD program state as an R image, and can be used to restart BARD.

Usage

  readBardCheckpoint(filen, continue = TRUE)
  writeBardCheckpoint(filen, restart.fun = NULL)

Arguments

filen Name (and path to) file to be read or written
continue Run restart function
restart.fun Function to run after reading back checkpoint to restart

Details

These functions read and write parts of the .GlobalEnv.

Value

Write return logical success invisibly. Read returns logical success invisibly, and restores selected .GlobalEnv state. If doContinue is TRUE, and read is successful, it launches restart function on exit.

Author(s)

Micah Altman Micah_Altman@harvard.edu http://www.hmdc.harvard.edu/micah_altman/

See Also

Other methods for readBardImage, writeBardImage, exportBardShape, importBardShape

Examples

  # read in a shapefile with demographic data
  suffolk.map <- importBardShape(
    system.file("shapefiles/suffolk_tracts.shp", package="BARD"))
    
  # choose number of districts
  ndists <- 5

  # create some initial plans
  kplan1 <- createKmeansPlan(suffolk.map,ndists)
  kplan2 <- createKmeansPlan(suffolk.map,ndists)

  # read and write images
  writeBardCheckpoint(paste(tempdir(),"/checkpoint1",sep=""),
    restart.fun=function(){cat("Welcome back\n")})
  readBardCheckpoint(paste(tempdir(),"/checkpoint1",sep=""))

[Package BARD version 1.03 Index]