| Type: | Package |
| Title: | Reapportion Data from One Geography to Another |
| Version: | 0.2.0 |
| Maintainer: | François Briatte <f.briatte@gmail.com> |
| Description: | A port of the 'spReapportion' package, using Simple Features in order to lose the dependencies to the retired 'maptools' and 'rgeos' packages. |
| License: | GPL-3 |
| LazyData: | TRUE |
| URL: | https://github.com/briatte/sfReapportion |
| BugReports: | https://github.com/briatte/sfReapportion/issues |
| Depends: | R (≥ 4.1) |
| Imports: | dplyr, sf, sp (≥ 2.0-0) |
| Suggests: | areal, populR, testthat |
| RoxygenNote: | 7.3.3 |
| Encoding: | UTF-8 |
| NeedsCompilation: | no |
| Packaged: | 2026-04-20 15:21:33 UTC; fr |
| Author: | François Briatte |
| Repository: | CRAN |
| Date/Publication: | 2026-04-21 20:32:10 UTC |
Voter addresses in the 20th arrondissement of Paris
Description
All voter addresses located in the 20th arrondissement of Paris, according to
the Répertoire électoral unique (REU). We first extracted polling stations
from table-bv-reu.parquet, and then extracted addresses located within
them from table-adresses-reu.parquet. Addresses were converted into
spatial points of class sf. The weight variable is nb_adresses,
although that variable does not count voters per se: it measures the number
of voter addresses at that particular location, which is probably the best
publicly available proxy at that level of precision.
Usage
Paris20eAddresses
Format
An object of class sf (inherits from grouped_df, tbl_df, tbl, data.frame) with 5820 rows and 3 columns.
Source
INSEE: https://www.data.gouv.fr/datasets/bureaux-de-vote-et-adresses-de-leurs-electeurs
Paris IRIS shapefile, 2013
Description
A shapefile of the IRIS (French census tract) of Paris in 2013.
Usage
ParisIris
Format
An object of class SpatialPolygonsDataFrame with 992 rows and 7 columns.
Source
IGN: https://cartes.gouv.fr/rechercher-une-donnee/dataset/IGNF_CONTOURS-IRIS
Paris polling stations shapefile, 2012
Description
A shapefile of the polling stations in Paris in 2012.
Usage
ParisPollingStations2012
Format
An object of class SpatialPolygonsDataFrame with 867 rows and 5 columns.
Source
Ville de Paris: https://opendata.paris.fr/explore/dataset/zones-de-rattachement-des-bureaux-de-vote-en-2012/table/
Socio-professional breakdown of the population aged 15+ in Paris, 2011
Description
A dataset containing the number of inhabitants by socio-professional category in 2011 in Paris, by IRIS (the French census tract).
Usage
RP_2011_CS8_Paris
Format
An object of class data.frame with 992 rows and 10 columns.
Details
-
C11_POP15P: nombre de personnes de 15 ans ou plus -
C11_POP15P_CS1: Agriculteurs exploitants -
C11_POP15P_CS2: Artisans, Commerçants, Chefs d'entreprise -
C11_POP15P_CS3: Cadres et Professions intellectuelles supérieures -
C11_POP15P_CS4: Professions intermédiaires -
C11_POP15P_CS5: Employés -
C11_POP15P_CS6: Ouvriers -
C11_POP15P_CS7: Retraités -
C11_POP15P_CS8: Autres sans activité professionnelle
Source
INSEE: https://www.insee.fr/fr/statistiques/2028584
Aggregate Spatial Polygons
Description
A replacement for rgeos::unaryUnion.
Usage
sfAggregate(sp, id)
Arguments
sp |
an |
id |
a grouping vector, as required by |
Value
a SpatialPolygonsDataFrame object with unique and
valid feature IDs
Note
Source: https://github.com/r-spatial/sf/issues/2563
Author(s)
Roger Bivand (thanks)
Reapportion data from one geography to another
Description
This function allows to reapportion data from one geography to another, for example in the context of working with different administrative units.
Usage
sfReapportion(
old_geom,
new_geom,
data,
old_ID,
new_ID,
data_ID,
variables = names(data)[-which(names(data) %in% data_ID)],
mode = "count",
weights = NULL,
weight_matrix = NULL,
weight_matrix_var = NULL
)
Arguments
old_geom |
a 'SpatialPolygonsDataFrame' or 'sf' object representing the initial geometry. |
new_geom |
a 'SpatialPolygonsDataFrame' or 'sf' object representing the geometry you want to reapportion data to. |
data |
a 'data.frame' containing the data to reapportion, and an ID allowing to match it to the 'old_geom'. |
old_ID |
a string, the name of the ID variable in the 'old_geom'. |
new_ID |
a string, the name of the ID variable in the 'new_geom'. |
data_ID |
a string, the name of the ID variable in the 'data'. |
variables |
a character vector, representing the names of the variables in the 'data' set to reapportion. By default, all data variables except for the ID. |
mode |
either |
weights |
(optional, lightly tested only) In case the variables are proportions, the name of the variable containing weights (i.e. the total number of observations per unit in the 'old_geom'). |
weight_matrix |
(optional, lightly tested only) a 'SpatialPointsDataFrame' or 'sf' object indicating the spatial coordinates of the observations (inhabitants, voters, etc.). |
weight_matrix_var |
(optional, lightly tested only) the name of
the (numeric) variable containing the weights in |
Value
a 'data.frame' containing new_ID and the reapportioned
variables from data
Note
Inspiration from https://stackoverflow.com/a/17703903 and
https://rpubs.com/PaulWilliamson/6577.
Original sp version available at https://github.com/joelgombin/spReapportion.
All mistakes are mine, obviously. More details appear in the README file.
Author(s)
Joël Gombin (initial sp version),
François Briatte (sf port)