I am trying to make an interactive map with different layers in which the user can pick one of 8 different layers. The shape for all the layers is the exact same, the only thing changes is the column.
Ideally I would want something like this, but this doesn't work as the selectable interactive layers come from the tm_shape, not tm_fill.
library(tmap)
tmap_mode("view") +
tm_shape(MAP_DATA) +
tm_fill(col = "COLUMN1") +
tm_fill(col = "COLUMN2") +
tm_borders()
I can get this to work, but it feels very inefficient:
MAP_DATA2 <- MAP_DATA
tmap_mode("view") +
tm_shape(MAP_DATA) +
tm_fill(col = "COLUMN1") +
tm_borders() +
tm_shape(MAP_DATA2) +
tm_fill(col = "COLUMN2") +
tm_borders()