Publications by Albert Rapp
Analyze your Twitter timeline with {rtweet} and {lubridate}
This week, I am oddly proud to announce that I have reached 1000 followers on Twitter. Check out the visualization that I have created for this joyous occasion. To me, my rising follower count and the somewhat regular mails that I receive are a sign that people like to read my blog. And to thank you all for following my work, let me give you a q...
8547 sym R (5105 sym/24 pcs) 12 img 12 tbl
How to embed a Shiny app into your blog posts
Today’s a short blog post. It’s mainly for sharing a cool trick I just learned. Here’s a simple template to incorporate your Shiny app into an HTML file. For instance, you can incorporate your shiny app into your blog post like I do here. Simply exchange the src argument by your Shiny app’s URL and then you’re good to go. Here, I use th...
1031 sym R (118 sym/1 pcs)
Animating kernel density estimators
For my first post on this blog I decided to create an animation using the animation package. To give this animation some purpose let me demonstrate how kernel density estimators work with the help of an animation. In general, kernel density estimators are, as is kind of obvious by the name, used to estimate the underlying density of a random samp...
5417 sym R (5394 sym/22 pcs) 16 img 11 tbl
Is Success Luck or Hard Work?
Recently, I decided to try out a few stretches in an effort to stay in shape during long stretches of working from home and not leaving the house. Also, to distract me from my inflexible body I thought I would watch a video on YouTube simultaneously and as luck would have it, I saw an interesting video on Veritasium’s YouTube Channel called “...
12159 sym R (4684 sym/13 pcs) 10 img 6 tbl
Beginning a ggplot2 Series: Logarithmize Your Scales
It is not that long ago when I first encountered ggplot2 and decided to learn how to use it1. By no means do I think that I have sufficiently mastered this package yet but as time has passed I have certainly picked up a few tips on my journey to get better at creating more meaningful visualizations. So, in order to remind myself of and share what...
6367 sym R (771 sym/12 pcs) 12 img 6 tbl
ggplot tips: Assigning Labels to an Aesthetic
This blog post is part of a series I am creating where I collect tips I found useful when I first learned to work with ggplot2. All posts which are part of this series can be found here. In this post I want to deal with how to manually or automatically create labels for some aesthetic. Manually Assigning Labels Assigning labels by hand, e.g. via ...
5206 sym R (2292 sym/20 pcs) 18 img 10 tbl
ggplot tips: Using position_stack() for Individual Positioning
For a long time I have wondered why some people would use position_stack() for position alignment instead of the simpler version position = "stack". Recently, though, I learned the purpose of the former approach when I tried to add data labels to a stacked bar chart for better legibility. Further, I decided that this knowledge is a good addition ...
3144 sym R (1994 sym/12 pcs) 10 img 6 tbl
Writing Versatile Functions with R
This week, I had to deal with two very similar tasks on two very similar but not identical data sets that required me to write a function that is versatile enough to deal with both data sets despite their subtle differences. The differences that had to be accounted for mainly related to using functions in the two cases that relied on differently ...
9081 sym R (4819 sym/28 pcs) 14 tbl
Did German Voters Become More Impulsive?
A bit more than two weeks ago, Germany held a federal election and, naturally, this is always reason for a lot of discussions and subjective truths. One subjective truth I encountered myself related to how fast the party CDU/CSU was able to collect and lose votes according to polls right before the election. According to the Allensbach Institute,...
8325 sym 12 img
An Exploratory Introduction to the Plotly Package
Currently, I am quite curious about interactive plots which is why I am reading Scott Murray’s highly recommendable book on D3. For those of you who don’t know it, D3.js is a JavaScript library that is great for creating amazing interactive Data-Driven-Documents on the web. Unfortunately, compared to ggplot2, D3’s learning curve feels quite...
9838 sym R (4411 sym/34 pcs) 17 tbl