Learn R Programming

spdep (version 1.3-6)

card: Cardinalities for neighbours lists

Description

The function tallies the numbers of neighbours of regions in the neighbours list.

Usage

card(nb)

Value

An integer vector of the numbers of neighbours of regions in the neighbours list.

Arguments

nb

a neighbours list object of class nb

Author

Roger Bivand Roger.Bivand@nhh.no

Details

“nb” objects are stored as lists of integer vectors, where the vectors contain either the indices in the range 1:n for n as length(nb) of the neighbours of region i, or as.integer(0) to signal no neighbours. The function card(nb) is used to extract the numbers of neighbours from the “nb” object.

References

Bivand R, Pebesma EJ, Gomez-Rubio V, (2008) Applied Spatial Data Analysis with R, Springer, New York, pp. 239-251; Bivand R, Portnov B, (2004) Exploring spatial data analysis techniques using R: the case of observations with no neighbours. In: Anselin L, Florax R, Rey S, (eds.), Advances in Spatial Econometrics, Methodology, Tools and Applications. Berlin: Springer-Verlag, pp. 121-142, tools:::Rd_expr_doi("10.1007/978-3-662-05617-2_6").

See Also

summary.nb

Examples

Run this code
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
table(card(col.gal.nb))

Run the code above in your browser using DataLab