% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cell.R
\name{a5_u64_to_hex}
\alias{a5_u64_to_hex}
\alias{a5_hex_to_u64}
\title{Coerce between hex strings and A5 cell vectors}
\usage{
a5_u64_to_hex(x)

a5_hex_to_u64(x)
}
\arguments{
\item{x}{For \code{a5_u64_to_hex()}, an \link{a5_cell} vector (or object
coercible to one). For \code{a5_hex_to_u64()}, a character vector of
hex-encoded cell IDs.}
}
\value{
\code{a5_u64_to_hex()} returns a character vector. \code{a5_hex_to_u64()}
returns an \link{a5_cell} vector.
}
\description{
\code{a5_u64_to_hex()} converts an \link{a5_cell} vector to 16-character
zero-padded hex strings. \code{a5_hex_to_u64()} converts hex strings to
an \link{a5_cell} vector.
}
\details{
These are named to match \code{u64_to_hex} / \code{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 \code{uint64} type, \code{a5_u64_to_hex()}
accepts an \link{a5_cell} (which stores the \code{u64} internally as eight raw
bytes) instead of a bare integer.
}
\examples{
cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 5)
hex <- a5_u64_to_hex(cell)
hex

a5_hex_to_u64(hex)
}
\seealso{
\code{\link[=a5_cell_from_arrow]{a5_cell_from_arrow()}} and \code{\link[=a5_cell_to_arrow]{a5_cell_to_arrow()}} for lossless
conversion between \link{a5_cell} and Arrow \code{uint64} arrays.
}
