grd_cell: Grid cell operators

Description Usage Arguments Value Examples

View source: R/cell.R

Description

Grid cell operators

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
grd_cell(grid, point, ..., snap = grd_snap_next)

grd_cell_range(
  grid,
  bbox = wk_bbox(grid),
  ...,
  step = 1L,
  snap = grd_snap_next
)

grd_cell_rct(grid, i, j = NULL, ...)

## S3 method for class 'grd_rct'
grd_cell_rct(grid, i, j = NULL, ..., out_of_bounds = "keep")

## S3 method for class 'grd_xy'
grd_cell_rct(grid, i, j = NULL, ..., out_of_bounds = "keep")

grd_cell_xy(grid, i, j = NULL, ...)

## S3 method for class 'grd_rct'
grd_cell_xy(grid, i, j = NULL, ..., out_of_bounds = "keep")

## S3 method for class 'grd_xy'
grd_cell_xy(grid, i, j = NULL, ..., out_of_bounds = "keep")

Arguments

grid

A grd_xy(), grd_rct(), or other object implementing grd_*() methods.

point

A handleable of points.

...

Unused

snap

A function that transforms real-valued indices to integer indices (e.g., floor(), ceiling(), or round()). For grd_cell_range(), a list() with exactly two elements to be called for the minimum and maximum index values, respectively.

bbox

An wk::rct() object.

step

The difference between adjascent indices in the output

i

1-based index values. i indices correspond to decreasing y values; j indices correspond to increasing x values. Values outside the range 1:nrow|ncol(data) will be censored to NA including 0 and negative values.

j

1-based index values. i indices correspond to decreasing y values; j indices correspond to increasing x values. Values outside the range 1:nrow|ncol(data) will be censored to NA including 0 and negative values.

out_of_bounds

One of 'keep', 'censor', 'discard', or 'squish'

Value

Examples

1
2
3
4
5
grid <- grd(nx = 3, ny = 2)
grd_cell(grid, xy(0.5, 0.5))
grd_cell_range(grid, grid$bbox)
grd_cell_rct(grid, 1, 1)
grd_cell_xy(grid, 1, 1)

paleolimbot/grd documentation built on Dec. 22, 2021, 6:38 a.m.