Category Archives: Tips & Tricks

How to order factors by level frequency and level name

Intro Quite frequently, factor variables are ordered by level frequency. However, factor levels having only a few observations are sometimes collapsed into one level usually named “others”. Since this level is usually not of particular interest, it may be a … Continue reading

Posted in Tips & Tricks, Visualizing Data | Tagged | 2 Comments

Postleitzahlen mit führender Null richtig formatieren

Intro Importiert man Postleitzahlen aus anderen Datenformaten (z.B. Excel, Access) in R, ist es nicht selten, dass Postleitzahlen programmintern tatsächlich auch als Zahlen abgespeichert werden. Wie ein Blick auf einen im Internet frei verfügbaren Datensatz zeigt, kann dies zu folgendem … Continue reading

Posted in Tips & Tricks | Tagged , | 2 Comments

R Markdown: How to place two tables side by side using ‘knitr’ and ‘kableExtra’

Intro When I was recently writing some report using R Markdown, I wanted to place two rather small tables side by side. Since I usually use the kable()-function of the knitr package and the kableExtra package to print tables, I … Continue reading

Posted in Tips & Tricks | Tagged , | 3 Comments

How to Assign Variable Labels in R

Intro Defining variable labels is a useful way to describe and document datasets. Unlike SPSS, which makes it very easy to define variable labels using the data editor, base R doesn't provide any function to define variable labels (as far … Continue reading

Posted in Data Management, Fav R Packages, Tips & Tricks | Tagged | Leave a comment

How to fix problems after updating to R 3.4.1 on Linux Mint 18.1 / Ubuntu 16.04

The Problem After updating R to version 3.4.1 (“Single Candle”) on Linux Mint 18.1, RStudio could neither find my installed R packages nor was it possible to install R packages into some other directory. The Solution Fortunately, this problem could … Continue reading

Posted in Tips & Tricks | Tagged , | Leave a comment

How to install the ‘RWordPress’ package in R

The RWordPress package is a very convenient tool for publishing blog posts from R to WordPress. In his blog post Publish blog posts from R + knitr to WordPress, Yihui Xie explains how to install and use the package. Furthermore, … Continue reading

Posted in Data Management, Fav R Packages, Tips & Tricks | 13 Comments