From https://observablehq.com/@jwolondon/gridmap-allocation. Creates a list of grid locations of a stated size, with spacer positions removed.
Usage
grid_locations(n_row, n_col, spacers = list())
Arguments
- n_row
maximum number of rows defining grid. There must be at least as many grid cells as there are points to allocate.
- n_col
maximum number of columns defining grid. There must be at least as many grid cells as there are points to allocate.
- spacers
Optional list of grid cell locations defining grid location of fixed spacers which cannot be allocated points. Coordinates are in (row, column) order with origin top-left. Default is an empty array.
Examples
grid <- grid_locations(n_row = 8, n_col = 8, spacers = list())
grid
#> # A tibble: 64 × 2
#> row col
#> <int> <int>
#> 1 1 1
#> 2 1 2
#> 3 1 3
#> 4 1 4
#> 5 1 5
#> 6 1 6
#> 7 1 7
#> 8 1 8
#> 9 2 1
#> 10 2 2
#> # ℹ 54 more rows