I am plotting 2 maps side by side in lattice using an spplot command, using the simple default choropleth style color fill in sp. The syntax I am using is identical to this example:
library(sp)
library(rgdal)
library(lattice)
spplot(nc, c("SID74", "SID79"), names.attr = c("1974","1979"),
colorkey=list(space="bottom"), scales = list(draw = TRUE),
main = "SIDS (sudden infant death syndrome) in North Carolina",
sp.layout = list(arrow), as.table = TRUE)
The maps plot perfectly and exactly as intended side by side. However, I get a warning written on top of each of the maps as follows:
'Error using packet 1 length must be a 'unit' object'(on chart 1)
'Error using packet 2 length must be a 'unit' object' (on chart 2)
I apologize that I cannot give the data here to help troubleshoot. However, I was hoping someone might be able to point me in the right direction of figuring out what is going wrong.
Note: both maps chart perfectly fine as individual maps using the equivalent of:
spplot(nc,"SID74")
Clearly the problem is with the lattice view, but I am not familiar enough (despite having tried to look in Sarkar ch8) with packets to be able to know what is going wrong.
As an alternative, given that my charts are mapping as required, is there a way simply to turn off these warnings?
Many thanks for any help
http://rspatial.r-forge.r-project.org/gallery/#fig09.R gives the commands that reproduce your case. For me, with sp 1.1-1, everything works fine - I get the exact example figure.
If you did something with these data that causes this to malfunction, please report what you did, without that your question is misplaced.