data('kentucky')
kentucky = terra::unwrap(kentucky)
# remove all the neighbours Ballard county
kSub = kentucky[-c(2,20,79),]
adjMat = terra::adjacent(kSub)
attributes(adjMat)$region.id = kSub$County
nFile = tempfile()
nbRes = nbToInlaGraph(adjMat, nFile)
# Ballard is region 3
nbRes['Ballard']
# note that Ballard has no neighbours
table(adjMat[,'from']==3)
cat(readLines(nFile, n=5), sep='\n')
# \donttest{
# there will be a warning about zero neighbours
junk = bym(poverty ~ 1, data=kSub, family='gaussian', num.threads=3)
# }
Run the code above in your browser using DataLab