fuse: Combine Regions

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fuse.R

Description

Combines a list of several regions of a map object in boundary format into a single region.

Usage

1
fuse(map, regions, name)

Arguments

map

Map object in boundary format that should be modified.

regions

Vector of regions to be combined

name

Name that should be given to the region arising from fusing the specified regions.

Value

Map object in boundary format with the specified regions combined.

Author(s)

Nadja Klein

See Also

read.bnd,write.bnd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: require("gpclib")
library("maptools")
gpclibPermit()
map <- read.bnd(system.file("examples/germany9301.bnd", package="BayesX"))
drawmap(map=map, drawnames=TRUE)

#vector of regions to be combined 
regions <- c("1056","1060","1061")
#new name of combined region
newname <- "1"
newmap <- fuse(map,regions,newname)
drawmap(map=newmap,drawnames=TRUE)

#vector of regions to be combined
germany <- read.bnd(system.file("examples/germany.bnd", package="BayesX"))
drawmap(map=germany, drawnames=TRUE)
regions <- c("9371","9373","9374","9471","9472","9474","9574")
#new name of combined region
newname <- "1"
newmap <- fuse(germany,regions,newname)
drawmap(map=newmap,drawnames=TRUE)
## End(Not run)

Example output

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.
Loading required package: sp
Checking rgeos availability: FALSE
 	Note: when rgeos is not available, polygon geometry 	computations in maptools depend on gpclib,
 	which has a restricted licence. It is disabled by default;
 	to enable gpclib, type gpclibPermit()
[1] TRUE
Warning message:
In gpclibPermit() :
  support for gpclib will be withdrawn from maptools at the next major release
Read 2588 records
Note: map consists of 83 polygons
Note: map consists of 63 regions
Reading map ... finished
There were 42 warnings (use warnings() to see them)
Read 8852 records
Note: map consists of 310 polygons
Note: map consists of 309 regions
Reading map ... finished

BayesX documentation built on Aug. 24, 2019, 9:03 a.m.