write.nb.gal: Write a neighbours list as a GAL lattice file

Description Usage Arguments Author(s) See Also Examples

View source: R/read.gal.R

Description

Write a neighbours list as a GAL lattice file, may also use newer GeoDa header format

Usage

1
write.nb.gal(nb, file, oldstyle=TRUE, shpfile=NULL, ind=NULL)

Arguments

nb

an object of class nb with a list of integer vectors containing neighbour region number ids.

file

name of file with GAL lattice data

oldstyle

if TRUE, first line of file contains only number of spatial units, if FALSE, uses newer GeoDa style

shpfile

Shapefile name taken from GAL file for this dataset

ind

region id indicator variable name

Author(s)

Roger Bivand Roger.Bivand@nhh.no

See Also

read.gal

Examples

1
2
3
4
5
example(columbus)
GALfile <- tempfile("GAL")
write.nb.gal(col.gal.nb, GALfile)
col.queen <- read.gal(GALfile)
summary(diffnb(col.queen, col.gal.nb))

Example output

Loading required package: sp
Loading required package: Matrix

colmbs> require(maptools)
Loading required package: maptools
Checking rgeos availability: TRUE

colmbs> columbus <- readShapePoly(system.file("etc/shapes/columbus.shp",
colmbs+  package="spdep")[1])

colmbs> col.gal.nb <- read.gal(system.file("etc/weights/columbus.gal",
colmbs+  package="spdep")[1])
Warning message:
use rgdal::readOGR or sf::st_read 
Neighbour list object:
Number of regions: 49 
Number of nonzero links: 0 
Percentage nonzero weights: 0 
Average number of links: 0 
49 regions with no links:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Link number distribution:

 0 
49 

spdep documentation built on Aug. 19, 2017, 3:01 a.m.