Learn R Programming

ribiosUtils (version 1.7.7)

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(...)

Value

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

Arguments

...

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

Author

Jitao David Zhang <jitao_david.zhang@roche.com>

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

Examples

Run this code

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