Category Archives: ggplot2

Enjoy R: Do two consecutive seeds behave independently?

I’ve always wondered whether two random seeds in R provide independent results, whatever they are. In particular, I wanted to check if repeating a sampling operation with two consecutive seeds, say set.seed(20) and set.seed(21), this would produce unrelated outputs as expected. Pseudo-randomness in R is based on algorithms I honestly have read nothing about, and …

Continue reading

Enjoy R: Looping in R

Loops are run in most applications and are supported by all languages. In general, there are more than one way to execute the same task via looping, and the efficiency of each choice varies among languages. This post is not intended to demonstrate any general truth about R loops, but aims to provide some insights into some …

Continue reading

Enjoy R: Compare ROC curves of different multinomial classification models

When we think of a ROC curve, we usually refer it to a binary classification problem. For a multiclass case, it comes to be less used, also because it loses most of its explicative power. However, it would be good to use it also in this scenario in order to own one more weapon for diagnostics. …

Continue reading

Enjoy R: How to make a Pareto Chart using ggplot2 (and dplyr)

Hi all. The well-known choice of pushing ggplot2 users towards a cleaner and more correct way of plotting data, has led to the miss-implementation of a secondary axis. This is at the basis of the difficulty of plotting a Pareto Chart using this smart R package. In this post, I suggest a way to overcome this hurdle, by …

Continue reading