Creates sf polygon geometries for hexagonal grid cells.
Details
When called with a HexData object and no cell_id argument, this function generates polygons for all unique cells in the data, which is useful for plotting.
Examples
if (FALSE) { # \dontrun{
# From grid specification
grid <- hex_grid(area_km2 = 1000)
cells <- lonlat_to_cell(c(0, 10, 20), c(45, 50, 55), grid)
polys <- cell_to_sf(cells, grid)
# From HexData (all cells)
result <- hexify(df, lon = "lon", lat = "lat", area_km2 = 1000)
polys <- cell_to_sf(grid = result)
} # }