One of most common things one might do while making plots is to change tiny details of the plot to make them better. Often, one of such adjustments are changing x-axis tick mark label/text on a plot made with ggplot2 in R. Let us use ggplot2 to make plot first and then fix its x-axis […]
R Tips
Book Review – Data Visualization: A Practical Introduction
Data Visualization: A Practical Introduction by Duke University Professor Kieran Healy is a great introduction Data Visualization. If you have not heard of the book before, here is a little back story. The author, Kieran Healy developed the book using R Bookdown and made the whole book available online for free. Yes, it is available […]
Introduction to Maximum Likelihood Estimation in R – Part 1
The core of statistical inference can thought of situation like this. You have some observed data and you want to understand the actual population that generated the sample data you have. Parameter estimation by MLE One typically models that the observed data is generated by some probability distribution. For the sake of simplicity, let us […]
How To Make Grouped Boxplots with ggplot2?
Boxplots are great to visualize distributions of multiple variables. ggplot2 is great to make beautiful boxplots really quickly. Sometimes, you may have multiple sub-groups for a variable of interest. In those situation, it is very useful to visualize using “grouped boxplots”. In R, ggplot2 package offers multiple options to visualize such grouped boxplots. Let us […]
How To Reorder a Boxplot in R? Hint: Use forcats
Sometimes, when one is making boxplot with ggplot2, one might like to order the boxes in a boxplot in a specific way. For example, one might want to sort the boxes in boxplot in ascending or descening order based on the mean or median values of groups in the boxplot. Reordering boxplots can reveal the […]