Convert Coordinates to Grid Positions
coords_to_position(x, ..., n = 10L, extent = NULL)
# S3 method for data.frame
coords_to_position(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
# S3 method for matrix
coords_to_position(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
# S3 method for numeric
coords_to_position(x, y, ..., n, extent)
# S3 method for double
coords_to_position(x, y, ..., n, extent)
# S3 method for integer
coords_to_position(x, y, ..., n, extent)
coords_to_position64(x, ..., n = 10L, extent = NULL)
# S3 method for data.frame
coords_to_position64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
# S3 method for matrix
coords_to_position64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
# S3 method for numeric
coords_to_position64(x, y, ..., n, extent)
# S3 method for double
coords_to_position64(x, y, ..., n, extent)
# S3 method for integer
coords_to_position64(x, y, ..., n, extent)
One of: Numeric vector, data.frame
, or matrix
.
If a numeric vector, then it corresponds to X coordinates.
Unused.
Exponent to the dimensions of the underlying grid. The Hilbert
Curve indices are based on a 2^n x 2^n
grid. This number
must be less than 15 due to the 32-bit implementation of R.
Named vector with names xmax
, xmin
, ymax
, ymin
.
Corresponds to the bounding box of the given coordinates.
If extent
is NULL
, then the bounding box is found from the
given coordinates.
Column names or indices of a data.frame
/matrix
that
contain the coordinates.
If TRUE
, adds the position as new columns to the given
data.frame
/matrix
. This will replace the coordinate columns.
Numeric vector corresponding to Y coordinates.
A data.frame
containing the positions as integer
columns x
and y
, or the original object
(data.frame
or matrix
) with the coordinates
replaced with the grid positions. When n
is greater than 15,
the positions are of type bit64::integer64
.