add.neighbor: Add Neighborhood Relations

Description Usage Arguments Value Author(s) See Also Examples

View source: R/add.neighbor.R

Description

Adds a neighborhhod relationship between two given regions to a map object in graph format.

Usage

1
  add.neighbor(map, region1, region2)

Arguments

map

map object in graph format that should be modified.

region1, region2

character, names of the regions that should be connected as neighbors.

Value

Returns an adjacency matrix that represents the neighborhood structure of map plus the new neighborhood relation in graph format.

Author(s)

Felix Heinzl, Thomas Kneib.

See Also

get.neighbor, delete.neighbor, read.gra, write.gra, bnd2gra.

Examples

1
2
3
4
5
6
7
8
## read the graph file
file <- file.path(find.package("R2BayesX"), "examples", "Germany.gra")
germany <- read.gra(file)

## add some neighbors
get.neighbor(germany, c("1001", "7339"))
germany <- add.neighbor(germany, "7339", "1001")
get.neighbor(germany, c("1001", "7339"))

R2BayesX documentation built on May 21, 2017, 3:35 a.m.

Search within the R2BayesX package
Search all R packages, documentation and source code