Want to share your content on R bloggers? click here if you have a blog, or here if you don’t.
This note documents the release of the sfReapportion package.
A colleague of mine recently shared a code for one research project about the upcoming municipal elections in France, but the code required the spReapportion package, which has been difficult to install and use for a few years, due to some dependencies on it, maptools And rgeosbeen retired in favor of the sf package.
The spReapportion package that delivers area-weighted interpolationwas coded by a friend of mine. I decided to port his package so that it would lose its retired dependencies, and accept it sf objects too sp those. The result is available on GitHub as sfReapportion package.
At the same time, I rewrote my other colleague’s code to use that new package and make several other improvements. The maps below are from early results obtained with that code, which is the case on GitHub.
Rode
In France, as in many if not most other countries, the census tracts are called tracts IRIS in France, are spatially inconsistent with voting districts. If one wants to use data collected at the precinct level with voting data collected at the precinct level, one must first interpolate/remap that data to the spatial boundaries of voting precincts.
The two maps below show the polling stations (or polling stationsin French) of the city Lillewhose borders have been stable for several years. Each map shows the results of a separate principal components analysis, followed by a hierarchical clustering of the main components.
The map on the left is the interesting one. The data used for the underlying principal components analysis comes from the French Official Statistical Office, INSIGHTwho publishes this data at traction level. The data has been redistributed sfReapportion to coincide with the boundaries of the voting districts.
Limits
The sfReapportion package has only been lightly tested, especially when it comes to the weighted features. However, the main function, which uses unweighted population numbers, has been thoroughly tested and its results reproduced with the areal package.
The package only performs extensive area-weighted interpolation: for intensive or multiple (mixed) interpolation, users should turn to the areal package. Additional methods are also available through the populR package.
I don’t plan to update sfReapportion package a lot, as it was coded for reproducibility purposes, but users can open issues in the GitHub repository to ask questions or suggest improvements.
Related
#sfRedistribution #bloggers


