importBardShape {BARD}R Documentation

Import and export bard plans and basemaps as shapefiles

Description

These are convenience functions to read and write BARD data as ESRI shapefiles. For a faster method to store these in native form see readBardImage

Usage

exportBardShape(plan, filen, id = "BARDPlanID", gal = paste(filen, ".GAL", sep = ""))
importBardShape(filen, id="BARDPlanID", gal=paste(filen,".GAL",sep=""), wantplan=FALSE) 

Arguments

filen Name (and path to) file to be read or written
id name of polygon block (NOT plan) id variable
plan Plan assignment
wantplan whether to extract embedded BARD plan from shapefile
gal GAL style contiguity list. Contiguity list will be regenerated if not supplied, but this is slow.

Value

Read method returns a basemap by default. If "wantplan" is TRUE, read method returns a list with:

plan a plan, as identified by the BARDplan variable in the shapefile
basemap the basemap


Write method returns logical success, invisibly.

Note

Using createAssignedPlan with an imported plan is generally more memory efficient than using wantplan=TRUE.

Author(s)

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

See Also

Other methods for readBardCheckpoint, writeBardCheckpoint, readBardImage, writeBardImage

Examples


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

  # create some initial plans
  kplan1 <- createKmeansPlan(suffolk.map,ndists)
  
  # read and write images
  exportBardShape(file.path(tempdir(),"shape1"),plan=kplan1)

  # reimport 
  suffolk.map2<-importBardShape(file.path(tempdir(),"shape1"))
  kplan2<-createAssignedPlan(suffolk.map2)


[Package BARD version 1.03 Index]