R some blog

Some hopefully useful (or even awesome) stuff related to R programming.


R some blog

Nested unit tests with testthat

testthat
unit testing

The testthat package is the most widely used tool for unit testing in R. However, many users may not be aware of the possibility to nest test blocks within each other. In this post, I demonstrate how this underused feature provides a great way to structure and manage your unit tests.

Readable code with base R (part 2)

base R
coding style

It's been a while since my first on this topic. Nevertheless, it remains an important issue as (in my humble view) there is still too much code appearing in R packages that lacks good readability. So I hope this post helps to promote the beauty of readable code.

container: v1.0.0 on CRAN

container
list
R package

The update contains some breaking changes and brings a lot of new features and operators, which markedly improves using containers in both interactive R sessions and code development. Also there is a new class dict.table to support the data.table package.

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

R-Markdown
knitr

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.

Quicker knitr kables in RStudio notebook

R-Markdown
knitr
R-Studio

In this post a simple RStudio hack is presented on how to display tables produced via knitr kable efficiently in the RStudio session.

My R Style Guide

coding style

This is my take on an R style guide. As such, this is going to be a longer post in the hope that is useful to some people out there.

Readable code with base R (part 1)

base R
coding style

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. In this series of blog posts, I will present some (often underused) base R functions for this purpose.