Get index positions from a Hilbert Curve

position(h, ..., n = 10L)

# S3 method for data.frame
position(h, ..., n, idx = 1, attach = TRUE)

# S3 method for matrix
position(h, ..., n, idx = 1, attach = TRUE)

# S3 method for numeric
position(h, ..., n)

# S3 method for integer
position(h, ..., n)

position64(h, ..., n = 10L)

# S3 method for data.frame
position64(h, ..., n, idx = 1, attach = TRUE)

# S3 method for matrix
position64(h, ..., n, idx = 1, attach = TRUE)

# S3 method for double
position64(h, ..., n)

# S3 method for integer
position64(h, ..., n)

# S3 method for numeric
position64(h, ..., n)

# S3 method for integer64
position64(h, ..., n)

# S3 method for character
position64(h, ..., n)

# S3 method for bitstring
position64(h, ..., n)

Arguments

h

One of: Integer vector, data.frame, or matrix.

...

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. This must be the same as the n used in index.

idx

Column name or index containing the Hilbert Curve indices.

attach

If TRUE, adds the position as new columns to the given data.frame/matrix. If h is a data.frame, then the columns are named x and y; otherwise, it is two unnamed columns at the end of the matrix.

Value

A data.frame containing the positions as integercolumns x and y, or the original object (data.frame or matrix) with the columns attached. When n is greater than 15, the positions are of type bit64::integer64.