Compute rowwise mean and standard deviation

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() function to create some random vector. And then use matrix() function… Continue reading Compute rowwise mean and standard deviation

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 compute mean values of multiple columns at the same time using… Continue reading How to apply a function on multiple columns using across()

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 tidyverse and check the installed dplyr’s version. We… Continue reading 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 case_when() function with multiple examples. Let us start with creating a simple data frame… Continue reading dplyr case_when() to create new variable using multiple conditions

Exit mobile version