In this post, we will learn how to use dplyr's rows_update() function with examples. dplyr's rows_update() function is a useful function to modify or update specific rows in a data frame based on a matching values in key column. It takes in two dataframes x and y, updates … [Read more...] about dplyr rows_update(): Modify existing rows
rstats101
dplyr n_distinct(): count unique elements or rows
In this post, we will learn how to use dplyr's n_distinct() function to count the number of unique or distinct values in one or more vectors or columns of a dataframe. dplyr's n_distinct() is very useful when you are working with a dataframe and need to know how many unique … [Read more...] about dplyr n_distinct(): count unique elements or rows
How to perform multiple t-tests using tidyverse
In this tutorial, we will learn how to perform multiple t-tests to determine if there is any difference in mean using tidyverse framework. With tidyverse framework, we will use tidyverse packages/functions instead of looping through using a for loop. Let us load the packages … [Read more...] about How to perform multiple t-tests using tidyverse
How to select top and bottom rows by a column simultaneously
In this tutorial, we will learn how to select top and bottom rows of a dataframe based on the values of a column with tidyverse in R. Here we will see a specific approach to get top and bottom rows when the values of the column of interest has both positive and negative values. … [Read more...] about How to select top and bottom rows by a column simultaneously
How to Compute Pearson Correlation of Multiple Variables
In this tutorial, we will learn how to compute Pearson correlation of multiple variables. We will use two approaches to compute Pearson correlation of multiple variables in a matrix or dataframe. First we will show how to use cor() function in R to compute Pearson correlation … [Read more...] about How to Compute Pearson Correlation of Multiple Variables