grd_cell {wk} | R Documentation |
Grid cell operators
Description
Grid cell operators
Usage
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 'wk_grd_rct'
grd_cell_rct(grid, i, j = NULL, ..., out_of_bounds = "keep")
## S3 method for class 'wk_grd_xy'
grd_cell_rct(grid, i, j = NULL, ..., out_of_bounds = "keep")
grd_cell_xy(grid, i, j = NULL, ...)
## S3 method for class 'wk_grd_rct'
grd_cell_xy(grid, i, j = NULL, ..., out_of_bounds = "keep")
## S3 method for class 'wk_grd_xy'
grd_cell_xy(grid, i, j = NULL, ..., out_of_bounds = "keep")
Arguments
grid |
A |
point |
A handleable of points. |
... |
Unused |
snap |
A function that transforms real-valued indices to integer
indices (e.g., |
bbox |
An |
step |
The difference between adjascent indices in the output |
i , j |
1-based index values. |
out_of_bounds |
One of 'keep', 'censor', 'discard', or 'squish' |
Value
-
grd_cell()
: returns alist(i, j)
of index values corresponding to the input points and adjusted according tosnap
. Index values will be outsidedim(grid)
for points outsidewk_bbox(grid)
including negative values. -
grd_cell_range()
returns a slice describing the range of indices in thei
andj
directions. -
grd_cell_rct()
returns arct()
of the cell extent ati, j
. -
grd_cell_xy()
returns axy()
of the cell center ati, j
.
Examples
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)