
Areal-weighted interpolation via DuckDB (no masking)
Source:R/st_interpolate_aw.R
st_interpolate_aw_ducksf.Rd
st_interpolate_aw_ducksf()
is a user-facing, non-masking wrapper that
reproduces the semantics of sf::st_interpolate_aw()
while delegating work
to dst_interpolate_aw()
. It never masks sf
; call it explicitly.
There is also an internal shim, st_interpolate_aw()
(unexported),
with the same signature. It exists so that a future, optional
preference mechanism (e.g. via the conflicted package) could prefer
ducksf’s implementation without changing the search path. In this package
version, no masking is performed.
Usage
st_interpolate_aw_ducksf(x, to, extensive, ..., keep_NA = FALSE, na.rm = FALSE)
st_interpolate_aw(x, to, extensive, ..., keep_NA = FALSE, na.rm = FALSE)
Arguments
- x
An
sf
object with source polygons and attributes to interpolate.- to
An
sf
orsfc
with target polygons (coerced viasf::st_as_sf()
if needed).- extensive
Either a single logical (sf semantics) or a character vector of column names to treat as spatially extensive (package extension).
- ...
Ignored; present for drop-in compatibility with
sf
.- keep_NA
Logical; if
FALSE
, drop targets with no contributions in the requested variables (matches sf).- na.rm
Logical; if
TRUE
, drop rows ofx
that contain anyNA
before interpolation (matches sf).
Details
Areal-weighted interpolation via DuckDB (no masking)
CRS is inferred from inputs and passed to DuckDB as EPSG/WKT/JSON; for area work, use a projected CRS via
join_crs
indst_interpolate_aw()
.Weights mapping (sf semantics): if any variables are treated as extensive, the shim uses
weight = "total"
; otherwiseweight = "sum"
.
See also
sf::st_interpolate_aw()
for the original,dst_interpolate_aw()
for the fast-path API.
Examples
if (FALSE) { # \dontrun{
# Explicit, no masking:
res <- ducksf::st_interpolate_aw_ducksf(x = src_sf, to = tgt_sf, extensive = TRUE)
# Original sf still available:
res_sf <- sf::st_interpolate_aw(x = src_sf, to = tgt_sf, extensive = TRUE)
} # }