Point to polygon summary using target polygons and source points
Source:R/processing.R
summarize_pp.RdWhen x and y are different classes,
y will be converted to the class of x.
Usage
summarize_pp(x, y, ...)
# S4 method for class 'SpatVector'
summarize_pp(
x,
y,
target_fields = NULL,
id_x = "ID",
fun = mean,
extent = NULL,
...
)
# S4 method for class 'character'
summarize_pp(
x,
y,
target_fields = NULL,
id_x = "ID",
fun = mean,
out_class = "terra",
extent = NULL,
...
)
# S4 method for class 'sf'
summarize_pp(
x,
y,
target_fields = NULL,
id_x = "ID",
fun = mean,
extent = NULL,
...
)Arguments
- x
A sf/SpatVector object or file path of polygons to which point attributes will be summarized.
- y
A sf/SpatVector object or file path of points from which summaries will be calculated.
- ...
Additional arguments passed to
fun.- target_fields
character. Field names in
yto summarize.- id_x
character(1). The unique identifier of each polygon in
x. Default is"ID".- fun
function(1)/character(1). The function to calculate the point summary. Default is
mean. Character input should be a summary function accepted bymatch.fun().- extent
numeric(4) or SpatExtent object. Extent of clipping
x. It only works withxof character(1) file path. Seeterra::extfor more details. Coordinate systems should match.- out_class
character(1). "sf" or "terra". Output class.
Value
If x is sf, returns an sf object with summarized fields
joined to polygons. Otherwise returns a data.frame.
See also
Other Macros for calculation:
extract_at(),
kernelfunction(),
summarize_aw(),
summarize_sedc(),
summarize_st()
Author
Insang Song geoissong@gmail.com