Articles by Roman Pahl

Why I don’t use R Markdown’s ref.label

August 7, 2020 | Roman Pahl

Outline R Markdown provides the chunk option ref.label to reuse chunks. In this post, I'll show potential problems with this approach and present an easy and safe alternative. If you don't bother with the detailed Explanation, feel free to jump right to the Summary section. Explanation Consider you have ... [Read more...]

Why I don’t use R Markdown’s ref.label

August 7, 2020 | Roman Pahl

Outline R Markdown provides the chunk option ref.label to reuse chunks. In this post, I'll show potential problems with this approach and present an easy and safe alternative. If you don't bother with the detailed Explanation, feel free to jump right to the Summary section. Explanation Consider you have ... [Read more...]

Quicker knitr kables in RStudio notebook

November 16, 2019 | Roman Pahl

The setup The RStudio notebook is a great interactive tool to build a statistical report. Being able to see statistics and graphs right on the fly probably has saved me countless hours, especially when building complex reports. However, one thing that has always bothered me was the way tables are ...
[Read more...]

My R Style Guide

November 15, 2019 | Roman Pahl

This is my take on an R style guide. As such, this is going to be a very long post (long enough to warrant a table of content). Still, I hope it - or at least some parts of it - are useful to some people out there. Another guide ...
[Read more...]

Smartly select and mutate data frame columns, using dict

December 9, 2018 | Roman Pahl

Motivation Column operations Add Modify Remove Benchmark Summary Motivation The dplyr functions select and mutate nowadays are commonly applied to perform data.frame column operations, frequently combined with magrittrs forward %__% pipe. While working well interactively, however, these methods often would require additional checking if used in “serious” code, for example, ...
[Read more...]

Smartly select and mutate data frame columns, using dict

December 8, 2018 | Roman Pahl

Motivation The dplyr functions select and mutate nowadays are commonly applied to perform data.frame column operations, frequently combined with magrittrs forward %__% pipe. While working well interactively, however, these methods often would require additional checking if used in “serious” code, for example, to catch column name clashes. In principle, the ...
[Read more...]

Readable code with base R (part 1)

July 29, 2018 | Roman Pahl

Producing readable R code is of great importance, especially if there is a chance that you will share your code with people other than your future self. The now widely used magrittr pipe operator and dplyr tools are great frameworks for this purpose. However, if you want to keep your ...
[Read more...]

container – deque, set and dict for R

July 21, 2018 | Roman Pahl

Recently managed to put up my new package container on CRAN (and finally have a compelling reason to start an R-blog …). This package provides some common container data structures deque, set and dict (resembling Pythons dict type), with typical member functions to insert, delete and access container elements. If you ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)