tidyverse

It's a Bird, It's a Plane ... It's a ggforce function

ggforce is a powerful package that extends heavily the ggplot2 API. In this blog post, I won't go through all its capabilities, I'll just provide a sample of some cool functions that can be useful for ggplot2 coders.

Introducing the tidyr pivot_longer()

When working with a dataframe, it’s usually preferable that you respect the philosophy introduced by Hadley Wickham about the Tidy data where each variable has its own column and each observation its own row. So, what would you do when you encounter a “non-tidy” dataframe ? You would surely consider using the tidyr package which provides two important functions: pivot_longer() and pivot_wider(). In this short tutorial, we’ll introduce the pivot_longer().

Intro to the case_when function

case_when() is a dplyr function that returns a value according to predifined conditions. It’s a very powerful function though not very famous. In our example, we’ll use the mtcars dataset (just as usual). head(mtcars) ## mpg cyl disp hp drat wt qsec vs am gear carb ## Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 ## Mazda RX4 Wag 21.0 6 160 110 3.90 2.