--- title: "Filter the best classified occurrences within grid cells" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{naturaList_grid_filter_vignette} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` With `grid_filter()` you may filter occurrence records inside grid cells in order to keep only the record with the highest confidence level in each grid cell. ![Fig. 1 - The procedure of `grid_filter()` to select the record with the highest confidence level in each grid cell](../vignettes/grid_filter.png) As example, we will filter the `occ.class` in square grid cells of 0.5 decimal degree of side, which is the default grid cell size of `grid_filter()`. You can provide the height and width of the grid cell in `grid.resolution` argument, or provide a raster layer in argument `r` from which the cell is used to filter occurrences. ```{r grid_filter, eval=F} # Load package and data library(naturaList) data("A.setosa") data("speciaLists") # classification occ.class <- classify_occ(A.setosa, speciaLists) # grid filtering occ.grid <- grid_filter(occ.class) dim(occ.grid) table(occ.grid$naturaList_levels) ```