When I moved to Stockholm in early 2018, it was very cooold. Especially compared to my old hometown Munich. But, when time passed by, we went into a really hot May. Most of my colleagues were sure that this was the hottest May they ever experienced. But is this really true?
The easiest way is to put this year’s May temperatures in the context of the same month in previous years. These days it’s hard to get weather data without paying fees. However, I found the site Tutiempo.net, where they list (historical) temperatures back until 1978.
Cave: I cannot show you the code here, as someone could potentially use it to abuse the website. You can think of one of these gold standard apply examples.
Nevertheless, with data of the last twenty years at hands, we can plot the different Mays (is there a plural of May?). The thicker line is May 2018. OK, it seems that my colleagues are right and it really was warmer than in other years. But let’s stay scientific: Matthias, compare 2018 to the median of all years.
data_wide <- reshape(data, idvar = "Day", timevar = "Year", direction = "wide") data_wide$median <- apply(data_wide[, 2:ncol(data_wide)], MARGIN = 1, FUN = median, na.rm = TRUE)
I admit, I like R’s
apply family of functions! And it’s true, we had an extraordinarily hot May this year! Extracting information from bulky data is amazing. Well, we could also build the difference of each year to the overall median. For that, I recommend you the github of this little data exploration.
… and if anyone can explain me the temperature drop in many years around 10th May? Would be great!