a5_u64_to_hex: Coerce between hex strings and A5 cell vectors

View source: R/cell.R

a5_u64_to_hexR Documentation

Coerce between hex strings and A5 cell vectors

Description

a5_u64_to_hex() converts an a5_cell vector to 16-character zero-padded hex strings. a5_hex_to_u64() converts hex strings to an a5_cell vector.

Usage

a5_u64_to_hex(x)

a5_hex_to_u64(x)

Arguments

x

For a5_u64_to_hex(), an a5_cell vector (or object coercible to one). For a5_hex_to_u64(), a character vector of hex-encoded cell IDs.

Details

These are named to match u64_to_hex / hex_to_u64 in the upstream Python, JavaScript, and DuckDB A5 bindings. In those languages the functions convert between a native 64-bit unsigned integer and its hex representation. Because R has no native uint64 type, a5_u64_to_hex() accepts an a5_cell (which stores the u64 internally as eight raw bytes) instead of a bare integer.

Value

a5_u64_to_hex() returns a character vector. a5_hex_to_u64() returns an a5_cell vector.

See Also

a5_cell_from_arrow() and a5_cell_to_arrow() for lossless conversion between a5_cell and Arrow uint64 arrays.

Examples

cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 5)
hex <- a5_u64_to_hex(cell)
hex

a5_hex_to_u64(hex)

a5R documentation built on March 26, 2026, 5:10 p.m.