readBardImage {BARD}R Documentation

Read and write BARD basemaps and plans as R images.

Description

These are convenience functions to read and write BARD data as R images. This uses the native R image format, which is fast to read and to write. For a more portable, but slower approach see importBardShape

Usage

readBardImage(filen)
writeBardImage(filen, basemaps=NULL, plans=NULL)

Arguments

filen Name (and path to) file to be read or written
basemaps List of BARD basemaps to be written
plans List of BARD plans to be written

Value

Read method returns:

plans list of plans
basemaps list of basemaps


Write method returns logical success, invisibly.

Author(s)

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

See Also

Other methods for readBardCheckpoint, writeBardCheckpoint, importBardShape, exportBardShape

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
  writeBardImage(paste(tempdir(),"/image1",sep=""),
    basemaps=list(suffolk.map),plans=list(kplan1,kplan2))
  tmp.image<-readBardImage(paste(tempdir(),"/image1",sep=""))


[Package BARD version 1.03 Index]