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 […]
R
7 Tips to customize rectangle elements in ggplot2 element_rect()
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() […]
Row-wise operations in R: compute row means in tidyverse
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 […]
How To Compute Column Means in R with tidyverse
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 […]
How to Write Functions to Make Plots with ggplot2 in R
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 […]