8 tips to use element_blank() in ggplot2 theme

remove ggplot2 elements with element_blank

In this tutorial, we will see examples of using element_blank() to control the look of non-data aspects of a plot made with ggplot2. This is fourth in the series of understanding how to change four different elements of ggplot2’s theme systems. element_text() element_line() element_rect() element_blank() We saw how to use element_text() to change the looks… Continue reading 8 tips to use element_blank() in ggplot2 theme

7 Tips to customize rectangle elements in ggplot2 element_rect()

Anatomy of Rectangle Elements in ggplot2

Continuing the blog post series on how to control theme elements in ggplot2, in this post we will look at how to customize rectangular elements in ggplot2 using element_rect() function. ggplot2’s theme function helps us fully control the “non-data” elements of a plot made with ggplot2. ggplot2’s theme system comes with multiple element_ functions, element_text()… Continue reading 7 Tips to customize rectangle elements in ggplot2 element_rect()

Row-wise operations in R: compute row means in tidyverse

rowwise operations

This tutorial shows how to perform row-wise operations in R using tidyverse. We will use three key functions, rowwise(), c_across() and rowMeans() to perform to perform row-wise operations on a dataframe. rowwise() and c_across() functions are from dplyr. rowwise() function is available in dplyr 1.0.0+ to perform row-wise operations, like computing row means or other… Continue reading Row-wise operations in R: compute row means in tidyverse

How To Compute Column Means in R with tidyverse

Compute Column Means in R with across() and colMeans()

In this bite sized post, we will see how to compute column means in R using tidyverse. We will compute column means for a couple of scenarios. First we will see how to compute column means of a dataframe with no missing values. And then we will compute column means with missing values. We will… Continue reading How To Compute Column Means in R with tidyverse

How to Write Functions to Make Plots with ggplot2 in R

Scatter Plot with a lot code repetition

Okay here is a confession. Often I preach writing functions to simplify life at work. Although I try to follow the “writing functions” mantra decently, there is a grey area where I don’t use functions that much. Any guesses? Often make tonnes of exploratory plots with ggplot2 with tons of repetition of code with slight… Continue reading How to Write Functions to Make Plots with ggplot2 in R