Francisco Villamil


Carlos III - Juan March Institute
Department of Social Sciences
Universidad Carlos III de Madrid


Data & Code

Data and resources


R package: Territorial changes in Spanish municipalities

The R package muniSpain is designed to deal with territorial changes in Spanish municipalities when working with historical local-level data from different periods. It relies on the municipality codes from the Instituto Nacional de Estadística (INE) and the list of municipality changes compiled and corrected by Francisco J. Goerlich and Francisco Ruiz (see Goerlich and Ruiz 2018 and the package readme file for more information). The package also allows converting municipality names (including old and multi-language denominations) to INE codes. More information and installation on the Github repository.

Scraping census data from INE

R code to scrap census data from the Instituto Nacional de Estadística (INE)’s website.

Determining territorial origins of Spanish family names

R code to get the territorial origins of Spanish surnames from the INE database, used to determined whether a family names is territorially concentrated in any region in Spain (see e.g. this article for an application). The scraping relies on RSelenium.



Here I offer details, R scripts and raw data on historical patterns of violence and political behavior in Spain. It includes, among others, disaggregated data on civilian victimization during the Spanish Civil War, presence of trade unions in the 1930s or prewar electoral results.