Skip to content
Prev 26066 / 29559 Next

spplot help, please

The others are right, there is no state map in your code that you might 
add to the points plot.

After a quick inspection of which geographic area we are dealing with, 
here is one possible - and quite basic - solution on how to add state 
polygons of the US (if that is what you intend to do) to your plot:

## download state polygons for the us
library(raster)
usa = getData("GADM", country = "USA", level = 1)

## create subset of state polygons (otherwise spplot() will take quite 
long)
proj4string(res.adpt$SDF) = "+init=epsg:4326"

ext = extend(extent(res.adpt$SDF), 2.5)
states = crop(usa, ext)

## add state boundaries using 'sp.layout'
p = spplot(res.adpt$SDF, c("ols.e","gwr.e"), main = "Residuals",
 ?????????? sp.layout = list("sp.polygons", states))
p

Alternatively, you could also use latticeExtra::layer() instead of 
'sp.layout'. Simply have a look at the help pages for further details.

Cheers,
Florian


Am 21.10.2017 um 10:58 schrieb Edzer Pebesma: