Skip to content
Prev 27775 / 29559 Next

Highlight an area using symbol

On Mon, 18 Nov 2019, Raman Mishra wrote:

            
library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
library(tmap)
tm_shape(nc) + tm_fill("SID74")
set.seed(1)
is.na(nc$SID74) <- sample(1:nrow(nc), 5)
tm_shape(nc) + tm_fill("SID74")

tm_fill() denotes NA values automatically, and provides the easiest 
solution. You could also add a symbol, but I don't think this is 
necessary. tmap handles the older sp objects too, but new vector data work 
should use sf, not sp.

Hope this helps,

Roger