How to find common rows between two dataframe in R?
In this article, we are going to find common rows between two dataframes in R programming language.
For this, we start by creating two dataframes. Dataframes in use:
Method 1: Using inner join
We can get the common rows by performing the inner join on the two dataframes. It is available in dplyr() package
- data1 is the first dataframe
- data2 is the second dataframe
Example: R program to find the common rows in the two dataframes
Example: R program to get the common rows from the dataframes
Method 2 : Using intersect() function
This function is used to get the common rows from the dataframe. This function is available in the generics package so we need to import this package first.
- dataframe1 is the first dataframe
- dataframe2 is the second dataframe
Example: R program to get the common rows by using intersect() function
Please Login to comment...