if (interactive()) {
library(mapview)
## start the watcher
mapview::startWatching()
## load some data and watch the automatic visualisation
fran = mapview::franconia
brew = mapview::breweries
## stop the watcher
mapview::stopWatching()
## loading or removing things now will not trigger a view update
rm(brew)
trls = mapview::trails
## re-starting the viewer will re-draw whatever is currently available
mapview::startWatching()
## watcher can also be stopped via mapviewOptions
mapviewOptions(watch = FALSE)
rm(trls)
}
Run the code above in your browser using DataLab