shp2bnd {BayesX}R Documentation

convert a shape-file into a boundary object

Description

Converts the geographical information provided in a shape-file into a boundary object (see Ch. 5 of the Reference Manual)

Usage

shp2bnd(shpname, regionnames, check.is.in = TRUE)

Arguments

shpname Base filename of the shape-file (including path)
regionnames Either a vector of region names or the name of the variable in the dbf-file representing these names
check.is.in Test whether some regions are surrounded by other regions (FALSE speeds up the execution time but may result in a corrupted bnd-file)

Value

Returns a boundary object, i.e. a list of polygons that form the map. Additional attributes are

is.in Vector of regions that are completely contains in another region.
contains Vector of regions containing the regions specified in argument is.in.
height2width Ratio between height and width of the map. Allows customised drawing and storage in files by specifying the appropriate height and width.
class Indicates whether the map is stored in boundary format (bnd) or graph format (gra). Maps returned by read.bnd are of class bnd

Author(s)

Felix Heinzl, Daniel Sabanes Bove, Thomas Kneib with contributions by Michael Hoehle and Frank Sagerer

References

BayesX Reference Manual. Available from http://www.stat.uni-muenchen.de/~bayesx/

See Also

write.bnd,drawmap,read.bnd

Examples

## 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))

[Package BayesX version 0.2 Index]