Convert Grid Positions to Coordinates

position_to_coords(x, ..., n = 10L, extent = NULL)

# S3 method for data.frame
position_to_coords(x, ..., n, extent, coords = c(1, 2), attach = TRUE)

# S3 method for matrix
position_to_coords(x, ..., n, extent, coords = c(1, 2), attach = TRUE)

# S3 method for numeric
position_to_coords(x, y, ..., n, extent)

# S3 method for double
position_to_coords(x, y, ..., n, extent)

# S3 method for integer
position_to_coords(x, y, ..., n, extent)

position_to_coords64(x, ..., n = 10L, extent = NULL)

# S3 method for data.frame
position_to_coords64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)

# S3 method for matrix
position_to_coords64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)

# S3 method for numeric
position_to_coords64(x, y, ..., n, extent)

# S3 method for double
position_to_coords64(x, y, ..., n, extent)

# S3 method for integer64
position_to_coords64(x, y, ..., n, extent)

# S3 method for bitstring
position_to_coords64(x, y, ..., n, extent)

Arguments

x

One of: Integer vector, data.frame, or matrix. If a numeric vector, then it corresponds to Row positions.

...

Unused.

n

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.

extent

Named vector with names xmax, xmin, ymax, ymin. Corresponds to the bounding box of the given coordinates. If extent is NULL, then the function will throw an exception.

coords

Column names or indices of a data.frame/matrix that contain the positions.

attach

If TRUE, adds the coordinates as new columns to the given data.frame/matrix. This will replace the position columns.

y

Integer vector corresponding to Column positions.

Value

A data.frame containing the coordinates as numericcolumns x and y, or the original object (data.frame or matrix) with the positions replaced with the coordinates.