
Last chance! 50% off unlimited learning
Sale ends in
A data.frame containing coordinates (in terms of longitude and latitude) is joined to the polygon level. Then arithmetic operations on the attributes of the coordinates are applied to obtain aggregated values for each polygon.
points_to_polygon(sf_map, df, oper, crs = 4326, outside_print = FALSE)
object of class sf
data.frame containing coordinates (column names should be 'lon' and 'lat')
an arithmetic operation on the polygon level
coordinate reference system: integer with the EPSG code, or character with proj4string
print points that are not within a polygon (default is FALSE).
an object of class sf
# NOT RUN {
points_to_polygon(nl_postcode2, insurance, sum(amount, na.rm = TRUE))
# }
# NOT RUN {
shp_read <- sf::st_read("~/path/to/file.shp")
points_to_polygon(shp_read, insurance, sum(amount, na.rm = TRUE))
# }
Run the code above in your browser using DataLab