In this tutorial, we will learn how to get rows with lowest values of a column from a data frame in R. We will use dplyr’s slice_min() function to select rows with lowest values for a column in a data frame. We will also use slice_min() function in dplyr to find the bottom n rows… Continue reading slice_min: Get Rows with minimum values of a column
Category: dplyr
How to do inner join with dplyr in R
In this post, we will learn how to do an inner join in R with dplyr’s inner_join(). An inner join between two dataframes x and y, gives is the only rows from x for which we have a matching key in y. First, load tidyverse suit of packages and check the version of dplyr installed.… Continue reading How to do inner join with dplyr in R
Join dataframes by different column names with dplyr
In this tutorial, we will learn how to join dataframes by columns with different names in the two dataframes. dplyr offers a great set of tools to join or merge dataframes. We will use two approaches to merge two dataframe by different names. We will start with loading tidyverse. Then we will create two toy… Continue reading Join dataframes by different column names with dplyr
slice_max: get rows with highest values of a column
In this tutorial, we will learn how to get rows with maximum values of a column or variable from a dataframe. For example, from a dataframe with multiple rows and columns we will find a row (or multiple rows) with maximum values for a column. We will use dplyr’s slice_max() function to select rows with… Continue reading slice_max: get rows with highest values of a column
3 ways to rank numbers with tidyverse
In this tutorial, we will learn 3 ways to rank integers in tidyverse. Tidyverse’s dplyr has three integer ranking functions, row_number(), min_rank(), and dense_Rank(), inspired by SQL. And these integer ranking functions differ in how they handle ties. Let us jump into simple examples as given by dplyr and create tibble with a sorted column… Continue reading 3 ways to rank numbers with tidyverse