if (interactive()) {
library(leafem)
library(leaflet)
library(sf)
destfile = tempfile(fileext = ".gpkg")
st_write(st_as_sf(gadmCHE), dsn = destfile)
leaflet() %>%
addTiles() %>%
addLocalFile(destfile, popup = TRUE)
}
Run the code above in your browser using DataLab