Message-ID: <874df921-3481-d200-2954-340a83eff6b5@gmail.com>
Date: 2022-02-25T15:39:05Z
From: Bede-Fazekas Ákos
Subject: Request for help on R codes for equivalent QGIS operation
In-Reply-To: <CAEGXkYV4JT-hY67JeFm=EEHcpo-FxA5AGZ+mFq=2+GOc1fsqVg@mail.gmail.com>
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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo