Converts the geographical information provided in a shape-file into a boundary object (see Ch. 5 of the Reference Manual)
Base filename of the shape-file (including path)
Either a vector of region names or the name of the variable in the dbf-file representing these names
Test whether some regions are surrounded by other regions (FALSE speeds up the execution time but may result in a corrupted bnd-file)
Returns a boundary object, i.e. a list of polygons that form the
read.bnd for more information on the format.
Felix Heinzl, Daniel Sabanes Bove, Thomas Kneib with contributions by Michael Hoehle and Frank Sagerer
BayesX Reference Manual. Available from http://www.bayesx.org
1 2 3 4 5 6 7 8 9 10 11 12
## read shapefile into bnd object shpName <- sub(pattern="(.*)\\.dbf", replacement="\\1", x=system.file("examples/northamerica_adm0.dbf", package="BayesX")) north <- shp2bnd(shpname=shpName, regionnames="COUNTRY") ## draw the map drawmap(map=north) ## compare with shipped bnd file shippedBnd <- read.bnd(system.file("examples/northamerica.bnd", package="BayesX")) stopifnot(all.equal(north, shippedBnd))
Loading required package: shapefiles Loading required package: foreign Attaching package: 'shapefiles' The following objects are masked from 'package:foreign': read.dbf, write.dbf Note: Function plotsurf depends on akima which has a restricted licence that explicitly forbids commercial use. akima is therefore disabled by default and may be enabled by akimaPermit(). Calling this function includes your agreement to akima`s licence restrictions. Reading map ... finished Note: map consists originally of 224 polygons Note: After removing unnecessary surrounding polygons, the map consists of 224 polygons Note: map consists of 28 regions Warning message: commas in names of the regions have been deleted Read 25047 records Note: map consists of 224 polygons Note: map consists of 28 regions Reading map ... finished
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.