readBardImage {BARD} | R Documentation |
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
readBardImage(filen) writeBardImage(filen, basemaps=NULL, plans=NULL)
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 |
Read method returns:
plans |
list of plans |
basemaps |
list of basemaps |
Write method returns logical success, invisibly.
readBardImage
attempts to detect and convert images created by previous versions of BARD, however it may fail to convert them due to limits in the underlying R libraries it depends. Use exportBardShape
in the previous version importBardShape
to migrate if automatic conversion is unsuccessful.
Micah Altman Micah_Altman@harvard.edu http://www.hmdc.harvard.edu/micah_altman/
Other methods for readBardCheckpoint
, writeBardCheckpoint
,
importBardShape
, exportBardShape
# 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=""))