## NY leukemia
if (FALSE) {
library(foreign)
nydata <- read.dbf(system.file("misc/nydata.dbf", package="spData")[1])
library(sp)
coordinates(nydata) <- c("X", "Y")
plot(nydata)
nyadjmat <- as.matrix(read.dbf(system.file("misc/nyadjwts.dbf",
package="spData")[1])[-1])
ID <- as.character(names(read.dbf(system.file("misc/nyadjwts.dbf",
package="spData")[1]))[-1])
identical(substring(ID, 2, 10), substring(as.character(nydata$AREAKEY), 2, 10))
library(spdep)
nyadjlw <- mat2listw(nyadjmat, as.character(nydata$AREAKEY))
listw_NY <- nb2listw(nyadjlw$neighbours, style="B")
}
Run the code above in your browser using DataLab