"Hacking4Sciences" course from MTEC

September 19, 2024·Minna Heim

Do any of the following statements sound familiar to you or someone you know?

  • I have a non-computer science background.
  • I want to incorporate programming into my approach to working with data.
  • I want to be part of the open source ecosystem.

If so, the lecture “Hacking for Sciences – An Applied Guide to Programming with Data” by Dr. Matthias Bannert from the Swiss Economic Institute (KOF) at MTEC-ETH might be the right fit for you.

Learn how to construct a Cloropeth map:

By taking this course, you can learn how to better manage and visualise data. An example of what you could learn is how to construct a Cloropeth map: which maps the values of a variable available by region to a given continuous colour palette on a map.

image

To construct this map, you can get a definition of the shape of a country, here we use GeoJSON. Then you assign values to the different regions, and finally you can visualise this using the charting function from the {echarts4r} package. Below is the code used to create this map.

 1library(echarts4r)
 2library(viridisLite)
 3library(jsonlite)
 4
 5json_ch <- jsonlite::read_json(
 6  "https://raw.github..."
 7)
 8
 9
10d <- data.frame(
11  name = c("Zürich",
12           "Ticino",
13           "Zentralschweiz",
14           "Nordwestschweiz",
15           "Espace Mittelland",
16           "Région lémanique",
17           "Ostschweiz"),
18  values = c(50,10,100,50,23,100,120)
19)
20
21d |>
22  e_charts(name) |>
23  e_map_register("CH", json_ch) |>
24  e_map(serie = values, map = "CH") |>
25  e_visual_map(values,
26               inRange = list(color = viridis(3)))

The full interactive example can be found in the Hacking4Sciences course book

This highly interactive, block-style online course provides valuable big-picture guidance, teaches practical software development skills, and allows you to test your knowledge through a final group coding project. The course is open to PhD students at ETH, and interested guests or students at other levels are also welcome.

To learn more about the course and its philosophy, please visit the h4sci website https://h4sci.github.io.