# NOT RUN {
columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE)
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
coords <- coordinates(as(columbus, "Spatial"))
res <- listw2lines(nb2listw(col.gal.nb), coords)
summary(res)
tf <- paste0(tempfile(), ".gpkg")
st_write(st_as_sf(res), dsn=tf, driver="GPKG")
inMap <- st_read(tf)
summary(inMap)
diffnb(sn2listw(df2sn(as.data.frame(inMap)))$neighbours, col.gal.nb)
# }
Run the code above in your browser using DataLab