Filter grid by minimum observations and minimum number of treatments
Source:R/make_ofe_grid.R
select_grid.RdSpatially joins points to the grid, counts observations and distinct treatments per cell, and keeps only cells that satisfy both thresholds.
Arguments
- grid
An `ofe_grid` (from `make_grid()`) or an `sf` polygons grid with `CellID`.
- data
An `sf` object of points.
- x
Character scalar with the name of the treatment column in `data`.
- min_per_cell
Integer, minimum number of observations per cell (default 1).
- return_points
Logical, if `TRUE` also returns the joined points restricted to the selected cells (component `points_sel`). Default `FALSE`.