Running distance and pace distribution with R

Getting the data – again

Similar to this post, I again gathered my data. This time however, I bulk exported everything from Polar instead of Garmin (there is an app called SyncMyTracks that synchronizes different services).

Continue reading “Running distance and pace distribution with R”

Gathering every Bundesliga game ever played in a single CSV file

I struggled to obtain a compressed data set that contains the outcomes of every soccer game ever played in the Bundesliga so I created this data myself, available here at Github. The CSV file can also be directly downloaded here: fullBundesligaMatchHistory.

Continue reading “Gathering every Bundesliga game ever played in a single CSV file”

Using JavaScript within HTML in a post

On in the subreddit r/dataisbeautiful I found this awesome post of u/MournerV. He visualized the orientation of streets for any city you are interested in. I want to work with the given code and learn how to build awesome stuff like this too. He furthermore wrote about the whole procedure on his blog and uploaded the code to Github. The license is quoted at the end of this post.

I have never worked with JavaScript and at first I wanted to figure out how to get the code working on WordPress. That is what this post is about.

Continue reading “Using JavaScript within HTML in a post”

Visualizing the the best male running performances with R

The data

With a bunch of data about the best performances in different running events, I wanted to learn how to produce meaningful plots and inside with R and ggplot. The data is originally taken from http://www.alltime-athletics.com/men.htm a website by Peter Larsson. I did a lot of postprocessing to be able to handle the data more easily. I also wanted to learn how to work with R and data frames. Most of the source code was taken from StackOverflow or other sides. Especially helpful was also the ggplot documentation. The data set, together with the source code that produces the figures below can be downloaded from Github.

I consider data for the male running events: 100m, 200m, 400m, 800m, 1.500m, 5.000m, 10.000m and the marathon. For each event, there are hundreds to thousands of results. These results are sorted by best performance. I.e., this might be the 1000 best marathon performances. For each of these performances, we have the associated rank that comes along with that performance. But also data like the name, date of birth and nationality of the athlete. Some typical lines in the original data file look like this:

1, 2:02:57 , Dennis Kimetto , KEN , 22.04.84 ,1, Berlin , 28.09.2014
2, 2:03:02 , Geoffrey Mutai , KEN , 07.10.81 ,1, Boston , 18.04.2011
3, 2:03:03 , Kenenisa Bekele , ETH , 13.06.82 ,1, Berlin , 25.09.2016

Meaning that Dennis Kimetto from Kenya ran the marathon world record in Berlin in 2014 with a time of 2:2:57h. The second best performance all-time was from Geoggrey Mutai and the third best performance from Kenenisa Bekele. The data was obtained in July 2018, so there might be some changes in the future.

Continue reading “Visualizing the the best male running performances with R”

Fizzbuzz with two if-statements

What’s fizzbuzz?

According to http://wiki.c2.com/?FizzBuzzTest

The “Fizz-Buzz test” is an interview question designed to help filter out the 99.5% of programming job candidates who can’t seem to program their way out of a wet paper bag. The text of the programming assignment is as follows:
“Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.”

Everyone who knows to program a little bit can solve this problem.
However, there is something in there that makes the naive solution seem to be a bit ugly and I always wanted to find a way to overcome this. That is, to write the naive code, one would check for divisibility by 3 and divisibility by 5. To check divisibility by 15, one could use the flags obtained by the previous checks or make a new check for divisibility by 15.

Continue reading “Fizzbuzz with two if-statements”