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
How to Compute row means
In this tutorial, we will learn how to compute means of rows with tidyverse using dplyr package. We will see multiple examples to compute row means with dplyr. Wee will start with 3. examples of computing row means using rowMeans() and dplyr's row-wise operations on a dataframe … [Read more...] about How to Compute row means
How to compute row means in R
In this tutorial, we will learn about rowMeans() function in base R and use it to calculate mean of all rows in a matrix or a dataframe. We will see two examples to understand the use rowMeans() function. First, we will calculate mean of all rows in a matrix and dataframe with no … [Read more...] about How to compute row means in R