View source: R/duckspatial_df_sf_methods.R
| collect.duckspatial_df | R Documentation |
Materializes a lazy duckspatial_df object by executing the underlying
DuckDB query. Supports multiple output formats.
## S3 method for class 'duckspatial_df'
collect(x, ..., as = NULL)
ddbs_collect(x, ..., as = c("sf", "tibble", "raw", "geoarrow"))
x |
A |
... |
Additional arguments passed to |
as |
Output format. One of:
|
Collected data in the specified format
Data in the specified format
## Not run:
library(duckspatial)
# Load lazy spatial data
nc <- ddbs_open_dataset(system.file("shape/nc.shp", package = "sf"))
# Perform lazy operations
result <- nc |> dplyr::filter(AREA > 0.1)
# Collect to sf (default)
result_sf <- ddbs_collect(result)
plot(result_sf["AREA"])
# Collect as tibble without geometry (fast)
result_tbl <- ddbs_collect(result, as = "tibble")
# Collect with raw WKB bytes
result_raw <- ddbs_collect(result, as = "raw")
# Collect as geoarrow for Arrow workflows
result_ga <- ddbs_collect(result, as = "geoarrow")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.