![]() |
VOOZH | about |
In this article, we will discuss how we do the Intersection of Two Objects in R Programming Language using the intersect() function.
intersect() function in R Programming Language is used to find the intersection of two Objects. This function takes two objects like Vectors, Dataframes, etc. as arguments and results in a third object with the common data of both objects.
Syntax: intersect(x, y)
Parameters:x and y: Objects with the sequence of items
Output:
[1] 2 3 4
Output:
[1] "C" "D" "E" "F"
Output:
$x1
[1] 2 3 4Output:
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9 [,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12[1] 1 2 3 4 5 6 7 8 9