![]() |
VOOZH | about |
Two data frames can have similar rows, and they can be determined. In this article, we will find the common rows and common columns between two data frames, in the R programming language.
Approach
Data frames in use:
data1:
👁 Imagedata 2:
👁 ImageMethod 1: Using Intersect() Function:
Syntax: intersect(data , data2)
Parameters:
- data/data2 : It is the data frames on which we have to apply the function.
Example:
Output:
👁 ImageMethod 2: Using inner_join() function.
To find the common data using this method first install the "dplyr" package in the R environment.
install.packages("dplyr")
This module has an inner_join() which finds inner join between two data sets.
Syntax: inner_join(data1,data2)
Parameter:
- data1/data2: two datasets to be compared
Example:
Output:
👁 Image