The intersect()
function in R determines the intersection of the subsets of a probability space. For example, intersect(A, B)
returns the rows that are common to the subsets A
and B
.
intersect(x, y, ...)
The intersect()
function takes the following parameter values:
x
, y
: These are the data frame, or vector, objects that contain a sequence of elements. These are required values....
: This represents further arguments that are passed to or from other R methods. This is an optional value.The intersect()
function returns a vector, data frame, or a probability subset with the same data type as the input argument.
# Creating subsetsset_A = c('the', 'foo', 'the', 'bar', 'and', 'the', 'baz')set_B = c('The', 'Foo', 'the', 'Bar', 'and', 'the', 'Baz')# Implementing the intersect() functionintersect(set_A, set_B)
set_A
and set_B.
intersect()
function.