15 Tips to Customize lines in ggplot2 with element_line()

Tips to Customize line elements in ggplot2

As part of understanding and fine tuning ggplot2’s theme elements, we will focus on the anatomy of line elements and see 15 tips to control them with ggplot2’s theme system. With ggplot2’s theme system we can control the “non-data” elements of a plot made with ggplot2. ggplot2’s theme system comes with multiple element_ functions, element_text()… Continue reading 15 Tips to Customize lines in ggplot2 with element_line()

10 Tips to Customize Text Color, Font, Size in ggplot2 with element_text()

Tips to Customize Text in ggplot2 plot with element_text()

ggplot2’s theme system give us a great control over how the “non-data” elements of a plot should look like. The theme system helps elevate the plot you make by making finer changes and make it easy to look better. ggplot2’s theme system comes with multiple element_ functions, element_text() element_line() element_rect() element_blank() And they help control… Continue reading 10 Tips to Customize Text Color, Font, Size in ggplot2 with element_text()

How To Categorize Multiple Numerical Columns in R

Categorize columns with across()

Recently I had to convert a numerical matrix into categorical ones based on some conditions. Obviously there are multiple ways to go about. One of the key functions to categorize a numerical vector in R is to use cut() function, that allows to specify the intervals to categorize a numerical variable. Till now I was… Continue reading How To Categorize Multiple Numerical Columns in R

7 Tips to Add Columns to a DataFrame with add_column() in tidyverse

Often while doing data analysis, one might create a new column or multiple columns to an existing data frame. In this post we will learn how to add one or more columns to a dataframe in R. tibble package in tidyverse, has a lesser known, but powerful function add_column(). We will learn 6 tips to… Continue reading 7 Tips to Add Columns to a DataFrame with add_column() in tidyverse

tidyr’s pivot_longer(): Reshape Wide Data to Long/Tidy Data

pivot_longer(): tidyr

One of the most common activities while doing data analysis is to reshape data from one form to another. For human eyes and data collection, often it is easier to work with data in wider form. However, for analyzing data it is more convenient to have the data in tidy/long form in most circumstances. tidyr,… Continue reading tidyr’s pivot_longer(): Reshape Wide Data to Long/Tidy Data