Deprecated.
Spatially joins point data to polygon geometries and summarises a numeric point attribute for each polygon.
points_to_polygon(sf_map, df, oper, crs = 4326, outside_print = FALSE)summarise_points_by_polygon(
polygons,
points,
value,
fun = sum,
lon = "lon",
lat = "lat",
crs = 4326,
output_col = NULL,
na.rm = TRUE,
outside = c("message", "warning", "ignore"),
repair_geometry = TRUE
)
An sf object equal to polygons with an additional
summary column.
Deprecated. Use polygons instead.
Deprecated. Use points instead.
Deprecated expression used to aggregate values.
Coordinate reference system of the point coordinates. Default is
4326.
Deprecated. Use outside instead.
`points_to_polygon()` was renamed to [summarise_points_by_polygon()].
An object of class sf containing polygon geometries.
A data.frame containing point coordinates and the value to summarise.
A string giving the name of the numeric column in points
to summarise.
A summary function, such as sum, mean, or
length. Default is sum.
A string with the name of the longitude column in points.
Default is "lon".
A string with the name of the latitude column in points.
Default is "lat".
Optional string giving the name of the output column. If
NULL, the name is created from value and fun, for
example "amount_sum" or "amount_mean".
Logical. Whether to remove missing values when fun
supports an na.rm argument. Default is TRUE.
What to do when points fall outside all polygons:
"message" (default), "warning", or "ignore".
Logical. Whether to try sf::st_buffer(x, 0)
if transforming polygon geometries fails. Default is TRUE.
summarise_points_by_polygon(
polygons = nl_postcode2,
points = insurance,
value = "amount",
fun = sum
)
Run the code above in your browser using DataLab