I have blocks of census data (shapefile with the column of interest being pop20) and polygons of areas of interest (shapefile with the column of interest being site). I am trying to get a sum of the population within each of the areas of interest (see example of one area of interest and the census blocks below). I don't know how to join the population estimates (column: pop20) to the areas of interest and account for polygons that are only partially within the areas of interest.
Hence I am interested in the following:
- what is the population within each census block within each area of interest, accounting for some blocks only being partial inside (so if 1/2 the block is within the area of interest, assume the population is 1/2 of the value in pop20).
- Then what is the sum of all the blocks within the area of interest weighing the blocks that are only partially within the area of interest from part 1.
I have essentially imported by shapefiles using the sf package but then I don't know what to do (do I use st_intersection or st_join or something else)?
pop<-st_read("...\\pop_census2020_prj.shp") buff<-st_read("...\\trap_mcpbuff_prj.shp") Thank you for your help.
1Related questions 8 Combining polygons and calculating their area (i.e. number of cells) in R 0 Mean aggregation in R (Polygon in Polygon) 9 Calculating weighted polygon centroids in R Related questions 8 Combining polygons and calculating their area (i.e. number of cells) in R 0 Mean aggregation in R (Polygon in Polygon) 9 Calculating weighted polygon centroids in R 1 R: Calculating overlap polygon area 1 Summing values of attributes of overlapping polygons in SpatialPolygonsDataFrame with R 1 How can I extract an area weighted sum from a raster into a polygon in R? 2 How to calculate a weighted sum in R? 2 R: Calculate sum of polygon area or mean raster pixel value weighted by a non-linear function around geographic points 3 Surface Area Weighted Spatial Join of Polygons 0 calculating weighted sum of two columns with weights as two other columns Load 7 more related questions Show fewer related questions
Reset to default
