Learn R Programming

prob (version 1.0-1)

union: Union of Subsets

Description

Calculates the union of subsets of a probability space.

Usage

union(x, …)

# S3 method for default union(x, y, …)

# S3 method for data.frame union(x, y, …)

# S3 method for ps union(x, y, …)

Arguments

x, y

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

further arguments to be passed to or from other methods.

Value

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

Details

This function operates row-wise on dataframes, and element-wise among the outcomes of ps objects. The elements of union(x,y) are those elements in x or y, or both. The definition is taken to match the version in the base package.

See Also

intersect, setdiff

Examples

Run this code
# NOT RUN {
S <- cards()
A <- subset(S, suit == "Heart")
B <- subset(S, rank == "A" )
union(A, B)
   
# }

Run the code above in your browser using DataLab