How I got run over by dplyr::case_when

no Recently I had an issue using the SQL adopted function dplyr::case_when in case it could be of help to someone. Spoiler: just read the documentation and run meaningful checks on your data. The issue The case_when function is just another great tool. As the IF statements in SPSS or replace in Stata, it is useful to generate a new column in a data frame which relies on the combination of other variables avoiding a verbose nest of ifelse.

Cinco claves sobre las elecciones generales en Argentina

El día 27 de octubre les argentines están convocades a las urnas. De esas elecciones saldrá el próximo presidente de la República si consigue los apoyos suficientes en la primera vuelta. Las encuestas apuntan a que el opositor Alberto Fernández, peronista, que comparte candidatura con la expresidenta Cristina Fernández, podría vencer en la primera vuelta al actual presidente, Mauricio Macri. A partir de los resultados de las elecciones primarias obligatorias (PASO) del pasado agosto y los datos del censo se presentan algunas claves de esta cita electoral.

Merging election results and census data from Argentina

Full script and data can be found here . This data comes with no guarantee, please report any bug you may find. The task The Argentine general election will take place in October. Last August, after the mandatory simultaneous primaries elections (PASO) I tried to analyse the results alongside census data for the province of Buenos Aires (BA) and Ciudad de Buenos Aires (CABA). The election results aggregated at different levels (i.

Combining PDF and web data to create a data base of school results

Full script is accesible here . The task The objective of this post is to generate a data frame with the average marks obtained by the 17-year students of each highschool in the university entrance test (EvAU) in the spanish region of Castilla-La Mancha. The average grades will be enriched with some school characteristics (e.g. public/private, number of students or location). The EvAU results by school and subject are published in PDF here (for 2017/2018).