[R-sig-Geo] Aggregation and disaggregation in sf
Sean Trende
@trende @end|ng |rom re@|c|e@rpo||t|c@@com
Thu Oct 14 12:11:01 CEST 2021
Thank you all for developing this package and taking a huge amount of time to answer questions. I had a question that I found related answers to, but nothing directly on point. Perhaps I'm just not being sufficiently creative with my R coding, and I apologize if I missed the "explainer" elsewhere.
A common task is aggregating and disaggregating within a larger polygon set. I believe that I know how to do the following in the geomander package, but am wondering if there is a "pure" sf solution.
There is a simple version of the task, and a more complex one.
The simple version of task: You have two shapefiles, one of census blocks and one of precinct results. You have a polygon for a precinct that split 100 votes to 100 votes for candidates A and B in the preceding election. The precinct wholly contains three census blocks with respective populations of 100, 200 and 300.
The task is to identify those blocks that exist within the precinct from the broader block shapefile and then to apportion the votes among these census blocks proportional to population, such that you would have 16.6, 33.3, and 50 votes recorded at the block level for each candidate, respectively.
The more difficult version: Same facts, but now there is a 4th block that is split between precincts. So there has to be some sort of way to acknowledge these blocks and split them, likely in an arbitrary way between the portion within the precinct and without (e.g., 50-50 or by land area within each precinct)
I wouldn't impose upon you to actually write code, but if I could be directed toward the most relevant functions (or told to go play around in ArcGIS) it would be incredibly helpful.
Best regards,
Sean
More information about the R-sig-Geo
mailing list