While working in GeoDa on a data set of the US Census Shapefiles I can quickly create a connectivity histogram shown below:
Assuming that my data is sourced in the following manner:
# Download an read US state shapefiles
tmp_shps <- tempfile(); tmp_dir <- tempdir()
download.file("http://www2.census.gov/geo/tiger/GENZ2014/shp/cb_2014_us_state_20m.zip",
tmp_shps)
unzip(tmp_shps, exdir = tmp_dir)
# Libs
require(rgdal); require(ggplot2)
# Read
us_shps <- readOGR(dsn = tmp_dir, layer = "cb_2014_us_state_20m")
How can I arrive at a similar connectivity histogram in R? Addittionally, I would be interested in creating a meanigful histogram derived from distance matrix created in the following manner:
require(geospacom)
dzs_distmat <- DistanceMatrix(poly = us_shps, id = "GEOID",
unit = 1000, longlat = TRUE, fun = distHaversine)
In practice, I'm interested in achieving the following objectives:
- Summarising how often geographies border one another, ideally through a connectivity histogram shown above
- Summarising information on distances amongst geographies