Learn R Programming

ribiosUtils (version 1.5-6)

munion: Operations for multiple sets

Description

Set operation functions in the base package, union, intersect and setdiff, can only be applied to binary manipulations involving two sets. Following functions, munion, mintersect and msetdiff, extend their basic versions to deal with multiple sets.

Usage

munion(...)

Arguments

Vectors of items, or a list of them. See examples below.

Value

A vector of set operation results. Can be an empty vector if no results were returned.

Details

These functions apply set manipulations (union, intersect, or difference) in a sequential manner: the first two sets are considered first, then the third, the fourth and so on, till all sets have been visited.

See Also

union, intersect and setdiff.

Examples

Run this code
# NOT RUN {
set1 <- c("HSV", "FCB", "BVB", "FCN", "HAN")
set2 <- c("HSV", "FCB", "BVB", "HAN")
set3 <- c("HSV", "BVB", "FSV")

munion(set1, set2, set3)
mintersect(set1, set2, set3)
msetdiff(set1, set2, set3)

## sets can be given in a list as well
munion(list(set1, set2, set3))
mintersect(list(set1, set2, set3))
msetdiff(list(set1, set2, set3))

# }

Run the code above in your browser using DataLab