grd_snap_next: Index snap functions

View source: R/grd-subset.R

grd_snap_nextR Documentation

Index snap functions

Description

These functions can be used in grd_cell() and grd_cell_range(). These functions differ in the way they round 0.5: grd_snap_next() always rounds up and grd_snap_previous() always rounds down. You can also use floor() and ceiling() as index snap functions.

Usage

grd_snap_next(x)

grd_snap_previous(x)

Arguments

x

A vector of rescaled but non-integer indices

Value

A vector of integer indices

Examples

grd_snap_next(seq(0, 2, 0.25))
grd_snap_previous(seq(0, 2, 0.25))


wk documentation built on Oct. 12, 2024, 1:07 a.m.