knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The following code illustrates how to use the robust.quadcount function:
library(magrittr) library(robustmap) # Loading burglary data points file1 = system.file("extdata/burglary.shp", package = "robustmap") burglary <- sf::read_sf(file1) burglary <- data.frame(x=burglary$lon_m, y=burglary$lat_m) # Running robust_quadcount with default parameters burglary_map <- burglary %>% robust.quadcount(nsamples=200)
Once the function returns, the optimal granularity (in the same unit of the original coordinates) can be retrieved by:
burglary_map$opt_granularity
The map of burglary counts can be plotted using:
```r
terra::plot(burglary_map$counts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.