## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----------------------------------------------------------------------------- library(a5R) cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 10) vctrs::field(cell, "b1") vctrs::field(cell, "b8") ## ----------------------------------------------------------------------------- # Display calls format(), which converts to hex for readability cell # Explicit conversion a5_u64_to_hex(cell) # Round-trip from hex a5_cell("0800000000000006") ## ----------------------------------------------------------------------------- set.seed(42) cells <- a5_lonlat_to_cell( runif(1e6, -180, 180), runif(1e6, -80, 80), resolution = 10 ) # rcrd: eight contiguous raw vectors (8 × 1 byte × 1M ≈ 7.6 MB) format(object.size(cells), units = "MB") # equivalent hex strings would be ~81 MB # (16 chars + 56-byte SEXP header per string) hex <- a5_u64_to_hex(cells) format(object.size(hex), units = "MB") ## ----------------------------------------------------------------------------- cells_with_na <- a5_cell(c("0800000000000006", NA)) is.na(cells_with_na)