[R-sig-Geo] Request for help on R codes for equivalent QGIS operation

Bede-Fazekas Ákos b|@|ev||@t @end|ng |rom gm@||@com
Fri Feb 25 16:39:05 CET 2022


Dear Bhaskar,

function st_join() from package 'sf' is what you are searching for. See 
the examples in the help page of the function about the aggregation of 
the spatially joined data:
https://r-spatial.github.io/sf/reference/st_join.html

HTH,
Ákos Bede-Fazekas
Centre for Ecological Research, Hungary

2022.02.25. 16:23 keltezéssel, Bhaskar Mitra írta:
> Hello Everyone,
>
> I have two shapefiles :
>
> shp1 has 400 polygons. One of the columns is X.
> shp2 has 10 polygons.
>
> Both have the same extent and crs. I want to summarize the value of column
> X from shp1 within the
> boundary of each polygons for shp2
>
> Can anyone please suggest to me an equivalent approach in R to join
> attributes by location.
>
> I am using the following approach in QGIS:
>
> 1) Under Processing Toolbox, select Vector General
> 2) Join attributes by location (summary)
> 3) Select shp2 as Input Layer
> 4) Select shp1 as Join layer
> 5) Under Geometric properties, select intersects, overlaps,
> contains and within
> 4) Fields to summarizse: select X
> 5) Summaries to calculate: select sum
>
>
> I would really appreciate some help or suggestions in this regard.
>
> Thanks,
> Bhaskar
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list