Aggregate a Source Attribute onto Target Features Using 'anime'
anime_join.Rd
This function runs anime::anime()
to match source features to target features
based on angle and distance tolerances. The matched source attribute(s) are then
aggregated (sum, max, mean, etc.) and joined back to the target data.
Usage
anime_join(
source_data,
target_data,
attribute,
new_name,
agg_fun = sum,
weights,
angle_tolerance = 35,
distance_tolerance = 15
)
Arguments
- source_data
An
sf
object representing the source data.- target_data
An
sf
object representing the target data.- attribute
A character string, the name of the source attribute to aggregate.
- new_name
A character string for the output column name in the returned data frame.
- agg_fun
A function used to aggregate the matched values (e.g.,
sum
,mean
,max
). Defaults tosum
.- weights
A character vector of column names in the source data to be used as weights. (For example,
"target_weighted"
).- angle_tolerance
A numeric value for angular tolerance used by
anime
. Defaults to 35.- distance_tolerance
A numeric value for distance tolerance used by
anime
. Defaults to 15.