View source: R/atlas_polygon_converters.R
| as_polygon_atlas | R Documentation |
Sets the single geom slot to the brain_polygons representation,
converting from sf if needed. The result renders identically via the
geom_polygon-based path in ggseg, but no longer depends on the sf class
machinery in $data — useful for wasm builds and air-gapped installs.
as_polygon_atlas(atlas)
atlas |
A |
Conversion is lossless, so a single representation is kept (no redundant
sf alongside polygons). To rehydrate sf for geometric operations later,
use as_sf_atlas().
This doubles as the backward-compatible path for sf-optional installs: a
lite-only ggseg that meets a still-sf-backed atlas converts it on the fly
when sf is installed. When sf is not installed the geometry cannot be read,
so the call aborts with a pointer to migrate_atlas_files() — which the
atlas maintainer runs once (on a machine with sf) to ship the package in the
polygon format.
A ggseg_atlas whose $data$geom is a brain_polygons object.
## Not run:
poly <- as_polygon_atlas(dk())
is_atlas_polygon(poly) # TRUE
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.