intersect: Intersection of Subsets

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculates the intersection of subsets of a probability space. Comparisons are made row-wise, so that in the data frame case, intersect(A,B) is a data frame with those rows that are both in A and in B.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
intersect(x, ...)

## Default S3 method:
intersect(x, y, ...)

## S3 method for class 'data.frame'
intersect(x, y, ...)

## S3 method for class 'ps'
intersect(x, y, ...)

Arguments

x, y

vectors, data frames, or ps objects containing a sequence of elements (conceptually).

...

further arguments to be passed to or from other methods.

Details

This is a generic function, extended from the intersect function in the base package. The elements of intersect(x,y) are those elements in x and in y. The original definition is preserved in the case that x and y are vectors of the same mode.

Value

A vector, data frame, or subset of a probability space of the same type as its arguments.

Author(s)

G. Jay Kerns gkerns@ysu.edu, based on a suggestion made by Brian Ripley in R-devel, 12/11/07.

See Also

union, setdiff

Examples

1
2
3
4
S <- cards()
A <- subset(S, suit == "Heart")
B <- subset(S, rank == "A" )
intersect(A, B)

Example output

Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: fAsianOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fOptions

Attaching package: 'prob'

The following objects are masked from 'package:base':

    intersect, setdiff, union

   rank  suit
39    A Heart

prob documentation built on May 2, 2019, 6:11 p.m.