Skip to contents

Takes an x-range and a y-range, a grid size and returns the grid information.

Usage

create_grid(x_range, y_range, dim = c(4, 4), zone = NULL)

Arguments

x_range

size 2 vector with min and max x-range

y_range

size 2 vector with min and max y-range

dim

size 2 vector (n rows, n cols)

zone

zone for each grid cell

Value

tibble of grid info

Examples

data(skink)
zone = tibble::tibble(
  grid = 1:16,
  zone = rep(1:2, c(10, 6))
)
create_grid(
  range(skink$X),
  range(skink$Y),
  dim = c(4,4),
  zone
)
#> # A tibble: 16 × 8
#>     grid     X     Y  left right bottom   top  zone
#>    <dbl> <int> <int> <dbl> <dbl>  <dbl> <dbl> <int>
#>  1     1     1     1  33    98.5    94   171.     1
#>  2     2     2     1  98.5 164      94   171.     1
#>  3     3     3     1 164   230.     94   171.     1
#>  4     4     4     1 230.  295      94   171.     1
#>  5     5     1     2  33    98.5   171.  248.     1
#>  6     6     2     2  98.5 164     171.  248.     1
#>  7     7     3     2 164   230.    171.  248.     1
#>  8     8     4     2 230.  295     171.  248.     1
#>  9     9     1     3  33    98.5   248.  324.     1
#> 10    10     2     3  98.5 164     248.  324.     1
#> 11    11     3     3 164   230.    248.  324.     2
#> 12    12     4     3 230.  295     248.  324.     2
#> 13    13     1     4  33    98.5   324.  401      2
#> 14    14     2     4  98.5 164     324.  401      2
#> 15    15     3     4 164   230.    324.  401      2
#> 16    16     4     4 230.  295     324.  401      2