In this post, we will learn how to compute row-wise summary statistics like mean and standard deviation using dplyr's row_wise() function. First, let us load tidyverse and verify the version of dplyr. Let us create a toy dataframe with five columns. We use sample() … [Read more...] about Compute rowwise mean and standard deviation
dplyr
How to apply a function on multiple columns using across()
In this post, we will learn how to compute one or multiple functions on multiple columns using dplyr's across() function. dplyr's across() function can be used with summarize() or mutate() functions to operate on columns. In this example we will use summarize() function to … [Read more...] about How to apply a function on multiple columns using across()
How to remove rows with all NAs
In this tutorial, we will learn how to remove rows with all values are NAs using dplyr in tidyverse. For example in the cartoon illustration below we have a dataframe with three rows and two of the rows has NAs for all elements. We will learn how to filter out the rows with all … [Read more...] about How to remove rows with all NAs
How to Change Column Name with a variable name
In this post we will learn how to rename a column name in a dataframe with another name saved in a variable using dplyr. We will use dplyr's rename() function in combination with special functions that are part of tidyverse's tidy eval functionalities. First, let us load … [Read more...] about How to Change Column Name with a variable name
dplyr case_when() to create new variable using multiple conditions
In this tutorial, we will learn how to use dplyr's case_when() function to create a new variable based on multiple conditions. dplyr's case_when() function offers a genereal solution when you might needed multiple if_else() conditions. In this blog post, we’ll explore … [Read more...] about dplyr case_when() to create new variable using multiple conditions