Skip to content

Instantly share code, notes, and snippets.

View mhermans's full-sized avatar

Maarten Hermans mhermans

View GitHub Profile
class_c4_lbl_nl d72_2 n n_se pct
<fct> <dbl+lbl> <dbl> <dbl> <dbl>
1 Arbeidersklasse 1 [Totally agree] 1416. 40.1 0.167
2 Arbeidersklasse 2 [Tend to agree] 2670. 53.6 0.315
3 Arbeidersklasse 3 [Tend to disagree] 2108. 48.4 0.248
4 Arbeidersklasse 4 [Totally disagree] 2012. 47.6 0.237
5 Arbeidersklasse 5 [Don't know] 281. 18.7 0.0331
6 Lagere middenklasse 1 [Totally agree] 896. 32.6 0.153
7 Lagere middenklasse 2 [Tend to agree] 1954. 48.2 0.334
8 Lagere middenklasse 3 [Tend to disagree] 1687. 44.3 0.288
@mhermans
mhermans / alstadsaeter_2018_offshore_eu_gdp_swiss.csv
Last active February 26, 2022 10:41
Visualise barchart of offshore wealth, using gghighlight and ggtext to call out countries and directly label values
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 8 columns, instead of 3. in line 7.
country_name_en,country_name_nl,offshore_total_gpd_pct,offshore_swiss_gpd_pct,offshore_nonswiss_gpd_pct,offshore_nonswiss_caribbean_gpd_pct,offshore_nonswiss_asia_gpd_pct,offshore_nonswiss_eu_gpd_pct
Albania,Albanië,0.009099364830022943,0.003902763756464408,0.005196601073558535,0,0,0.005196601060415357
Austria,Oostenrijk,0.0788387199205287,0.053434090107880305,0.025404629812648388,5.020665119495822e-4,0.007873792222186092,0.017028771190398466
Belgium,België,0.1737783533244881,0.10349841462526806,0.07027993869922006,8.952427068932938e-4,0.002173648870789221,0.06721104507451295
Bosnia and Herzegovina,Bosnië en Herzegovina,0.050279356187570394,0.038434908810615606,0.011844447376954786,0,0,0.011844446974824816
Bulgaria,Bulgarije,0.041259899174114475,0.03265272313968249,0.008607176034431991,7.028093556917629e-5,6.035926334904682e-5,0.008476535463362765
Croatia,Kroatië,0.052318515832664274,0.03587663695040035,0.016441878882263925,0,3.112889888139514e-5,0.016410750703628525
Czech Republic,Tsjechië,0.0343543529592177
@mhermans
mhermans / 20220113_eurostat_hsw_pb5_subset.csv
Created January 14, 2022 13:13
Visualize a choropleth map of MSD prevalence in EU, using ggplot and the Eurostat API for data and administrative boundaries.
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 8 columns, instead of 4. in line 8.
diagnose,sex,age,unit,geo,time,values,iso3_code
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Slovakia,2020-01-01,73.2,SVK
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Czechia,2020-01-01,72.2,CZE
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Cyprus,2020-01-01,71.9,CYP
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Poland,2020-01-01,68.8,POL
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Croatia,2020-01-01,67.3,HRV
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Austria,2020-01-01,66.6,AUT
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of persons reporting a health problem,Latvia,2020-01-01,66.4,LVA
Musculo-skeletal disorders,Total,From 15 to 64 years,Percentage of p
@mhermans
mhermans / d_ess_w1w9_gincdif_w_subset.csv
Last active January 7, 2022 18:51
Visualise trendlines with "open" datapoints: support for government measures against income differences, 2002-2008
essround essround_year country_iso2c country_name_en gincdif n n_se pct
1 2002 BE Belgium Agree strongly 455.8474083830247 24.072560533532695 0.2402389636447017
1 2002 BE Belgium Agree 874.3859045814513 31.81838872669106 0.4608155265976179
1 2002 BE Belgium Neither agree nor disagree 222.14182432630625 15.803401128924667 0.11707233753417241
1 2002 BE Belgium Disagree 230.61341530385303 15.400839428531011 0.12153700312059507
1 2002 BE Belgium Disagree strongly 62.615122103693565 9.506878776946055 0.032999182985457044
1 2002 BE Belgium No answer 51.87124555313497 9.213506189195183 0.02733698611745588
1 2002 DE Germany Agree strongly 377.1438310354219 22.063114818446433 0.1258549246801835
1 2002 DE Germany Agree 1219.241623744965 41.250031564681194 0.4068674868738743
1 2002 DE Germany Neither agree nor disagree 519.7322472538389 26.613296784096732 0.17343744600677538
@mhermans
mhermans / ghent_sheep_map.R
Last active June 26, 2020 13:35
Map live Ghent sheep location
# API docs Real time locatie schapen Gent
# https://data.stad.gent/explore/dataset/sheep-tracking-gent/information/
library(httr)
library(leaflet)
library(lubridate)
sheep_data <- content(GET('https://data.stad.gent/api/records/1.0/search/?dataset=sheep-tracking-gent'))$records[[1]]
leaflet() %>% addTiles() %>% addMarkers(
lng = sheep_data$geometry$coordinates[[1]],
library(sf)
library(mapview)
library(tmap)
library(dplyr)
bodemkaart <- st_read('/home/rstudio/var/data/20170710_bodemkaart_2_0_download/shape/20170710_bodemkaart_2_0.shp')
#mapview(bodemkaart) => laat te traag
bebouwing <- bodemkaart %>%
filter(Type == 'bebouwde zones')
mapview(bebouwing)
@mhermans
mhermans / upython_daan.md
Last active April 4, 2020 14:16
Linkdump micropython / ciruitpython voor daan
@mhermans
mhermans / ess_w9_wealth_inequality_fair.md
Last active November 3, 2019 14:14
Rating of (un)fairness of level of wealth inequality (ESS W9)

ESS W9 (2018): "In your opinion, are differences in wealth in [country] unfairly small, fair, or unfairly large?"

   cntry fair  unfairly_large unfairly_small
 1 SI    8%    81%            11%           
 2 AT    14%   75%            11%           
 3 HU    8%    75%            17%           
 4 IT    6%    75%            19%           
 5 CY    9%    75%            16%           
 6 RS    5%    74%            22%           

7 EE 12% 71% 17%

@mhermans
mhermans / zotero_debian_notes.md
Last active October 30, 2019 12:32
zotero installation debian