Bins cells into square windows of a regular grid with origin 0 and returns the centre of the window holding the most cells (ties: the window with the smallest x index, then y index).
Usage
DensestGridWindow(cells, size, filter = list(), x = "x", y = "y")Examples
d <- data.frame(x = c(1, 2, 15, 16, 17), y = c(1, 2, 5, 6, 7))
DensestGridWindow(d, 10)
#> x y x0 y0 n
#> 1 15 5 10 0 3