Archive

Monthly Archives: December 2012

A friend of mine sent me yesterday a pdf file with the income of the members of the Spanish Congress in 2012. The file has been built by a collective of public employees who want to increase transparency and awareness of public data. The truth is that I have been messing around for a while trying to populate these data. The amounts being paid to public servants should be public and easily accessible to citizens, but unfortunately in Spain the open data philosophy is still developing, so the information sometimes is available but unstructured and we need to work harder than expected to structure, analyze and share these data. In this case, the file that I received was in pdf format, so even after a first phase of collaborative work, data were not ready to work with. So my first step was to convert the pdf file to an xls format. The original file contains the following variables for each of the 350 members of the Spanish Congress:

1. Name + Surname + political party (Diputado grupo)

2. Total (total income per month in euros)

3. Asign (basic income per month in euros)

4. Complem (economic snap of presidential table)

5. Gastos repres (representation expenses of presidential table)

6. Gastos libre disposic. (unrestricted expenditure of presidential table)

7-11 Income concepts for those who belong to specific commissions of the Congress (president, vicepresident and so on)

12. Indemniz. Residenc (housing allowance for living in Madrid)

13. Gobierno (income for those who are in the current gobernment)

I have added some variables to enrich data and allow external comparisons. Those variables are:

1. polside (political side – Left & Right)

2. xsmi (Proportion of total income over the minimum national salary measured in times)

3. xsmed (Proportion of total income over the mean national salary measured in times)

4. xsmoda (Proportion of total income over the mode national salary measured in times)

5. xsmediana (Proportion of total income over the median national salary measured in times)

Note that xsmi, xsmed, xsmoda and xsmediana are data from 2010 due to the unavailability of data from 2012. Final CSV file can be downloaded here.

Below find a bunch of R code and graphs that I built with these data.

# Income of the members of the Spanish Congress
# Load ggplot2 library
library(ggplot2)
# Plot total income
qplot(total,data=dipu)

total_count

# Plot total income + small multiples of political party
qplot(total,data=dipu) + facet_wrap(~ partido)

total_count_partido

# Plot total income + small multiples of political side (Left Vs Right)
qplot(total,data=dipu) + facet_wrap(~ polside)

total_count_polside

# Build a density chart of total income + small multiples of political party and political side
a + geom_density()
a + geom_density() + facet_wrap(~ polside)
a + geom_density() + facet_wrap(~ partido)

total_count_density_polside

total_count_density_partido

# Build a bin2d chart of total income vs proportion of total income over minimum national salary + small multiples of political party
b + stat_bin2d()
b + stat_bin2d(bins=10) + facet_wrap(~ partido)

total_xsmi_bin2d
total_xsmi_bin2d_partido
# Build a density chart of proportion of total income over minimum national salary + small multiples of political party
c + geom_density() + facet_wrap(~ partido)

xsmi_count_density_partido
# Build a density chart of proportion of total income over mean national salary + small multiples of political party
d + geom_density() + facet_wrap(~ partido)

xsmed_count_density_partido

# Plot proportion between base income and total income + small multiples of political side
qplot(base/total,data=dipu)
qplot(base/total,data=dipu) + facet_wrap(~ polside)

basestotal_countbasestotal_count_polside

# Plot proportion between mode income and total income + small multiples of political party
qplot(base/total,xsmoda,data=dipu,geom="jitter",color=polside) + facet_wrap(~ partido)

basestotal_xsmoda_polside_partido

# Plot economic snap of presidential table
qplot(commesa,Nombre,data=commesacrew,color=polside,size=total)

commesa_nombre_total_polside

# Plot representation expenses of presidential table
qplot(grepmesa,Nombre,data=grepmesacrew,color=polside,size=total)

grepmesa_nombre_total_polside

# Plot unrestricted expenditure of presidential table
qplot(glibmesa,Nombre,data=glibmesacrew,color=polside,size=total)

glibmesa_nombre_total_polside

# Plot members of the congress with total income under 4k eur
under4k qplot(total,Nombre,data=under4k,color=polside) + facet_wrap(~ partido)

total_nombre_under4k

# Plot members of the congress with total income between 4k eur and 5k eur
qplot(total,Nombre,data=bet4kand5k,color=polside) + facet_wrap(~ partido)

total_nombre_bet4kand5k

# Plot members of the congress with total income between 5k eur and 5.5k eur
qplot(total,Nombre,data=bet5kand5.5k,color=polside) + facet_wrap(~ partido)

total_nombre_bet5kand5.5k

# Plot members of the congress with total income between 5.5k eur and 6k eur
qplot(total,Nombre,data=bet5.5kand6k,color=polside) + facet_wrap(~ partido)

total_nombre_bet5.5kand6k

# Plot members of the congress with total income between 6k eur and 7k eur
qplot(total,Nombre,data=bet6kand7k,color=polside) + facet_wrap(~ partido)

total_nombre_bet6kand7k

# Plot members of the congress with total income between 7k eur and 8k eur
qplot(total,Nombre,data=bet7kand8k,color=polside) + facet_wrap(~ partido)

total_nombre_bet7kand8k

# Plot members of the congress with total income between 8k eur and 9k eur
qplot(total,Nombre,data=bet8kand9k,color=polside) + facet_wrap(~ partido)

total_nombre_bet8kand9k

# Plot members of the congress with total income between 9k eur and 10k eur
qplot(total,Nombre,data=bet9kand10k,color=polside) + facet_wrap(~ partido)

total_nombre_bet9kand10k

# Plot members of the congress with total income above 10k
qplot(total,Nombre,data=above10k,color=polside) + facet_wrap(~ partido)

total_nombre_above10k