| a5_to_arrow_table | R Documentation |
a5_to_arrow_table() converts a data frame to an Arrow Table, writing
a5_cell columns as uint64 and a5_covering columns as list<uint64>
(see a5_cell_to_arrow() and a5_covering_to_arrow()), and records
the A5 index version (a5_info()$index) in the schema metadata under
"a5_index".
a5_from_arrow_table() reverses it, turning uint64 columns into cells
and list<uint64> columns into coverings.
a5_to_arrow_table(x)
a5_from_arrow_table(x, cells = NULL, coverings = NULL)
x |
For |
cells, coverings |
Names of the columns to read as cells and as
coverings, or |
Ids stay exact throughout, never passing through doubles or text, so the
pair suits Parquet files and DuckDB queries. A table whose metadata
records a different index version is an error, since its ids would name
other cells; convert such ids with a5_migrate().
a5_to_arrow_table(): an Arrow Table. a5_from_arrow_table():
a data frame.
a5_info()
cells <- a5_lonlat_to_cell(c(-3.19, 135), c(55.95, 0), resolution = 10)
df <- data.frame(cell = cells, value = c(1.5, 2.5))
df$disk <- a5_grid_disk(cells, k = 1)
tbl <- a5_to_arrow_table(df)
tbl$schema
back <- a5_from_arrow_table(tbl)
identical(back$cell, df$cell)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.