A new version of the R package Patchwork is available on CRAN. If you are not familiar with the Patchwork, it is a R package developed by “one and only” Thomas Lin Pedersen and it makes it possible to combine multiple plots made with R either ggplot2 or base R into a single graphics. As […]
R
How To Remove Rows with Missing values using dplyr
Missing data is a common problem while doing data analysis. Sometimes you might to remove the missing data. One approach is to remove rows containing missing values. In this post we will see examples of removing rows containing missing values using dplyr in R. We will use dplyr’s function drop_na() to remove rows that contains […]
How To Move A Column to the Front with dplyr
In this post we will learn how to change column order or move a column in R with dplyr. More specifically, we will learn how to move a single column of interest to first in the dataframe, before and after a specific column in the dataframe. We will use relocate() function available in dplyr version […]
4 ways to select columns from a dataframe with dplyr’s select()
dplyr’s select() function is one of the core functionalities of dplyr that enables select one or more columns from a dataframe. With dplyr’s version 1.0.0, select() function has gained new functionalities that makes it easy to select columns in multiple ways. One of the most common ways to select columns is to use their names. […]
How to Compute Summary Statistics Across Multiple Columns in R
dplyr’s groupby() function lets you group a dataframe by one or more variables and compute summary statistics on the other variables in a dataframe using summarize function. Sometimes you might want to compute some summary statistics like mean/median or some other thing on multiple columns. Naive approach is to compute summary statistics by manually doing […]