Learn R Programming

bsearchtools (version 0.0.59)

indexesMerge: Intersection / union of list of indexes

Description

Functions to perform intersection or union of a list of integer vectors. This functions are used by DFI.subset for AND/OR filters

Usage

intersectIndexesList(lst,sorted=TRUE) unionIndexesList(lst,sorted=TRUE)

Arguments

lst
list of integer vectors on which intersection or union must be performed
sorted
logical value used to specify if the returned indexes should be sorted ascending (default TRUE)

Value

A vector of integers.

Details

The returned vector is sorted ascending. intersectIndexesList is implemented in C++ and corresponds to sort(unique(Reduce(f=intersect,x=lst))) (without the sort function if sorted=FALSE). unionIndexesList is partially implemented in C++ and corresponds to sort(unique(Reduce(f=union,x=lst))) (without the sort function if sorted=FALSE).

Examples

Run this code
intersectIndexesList(list(1:7,4:8,3:5))
unionIndexesList(list(1:7,4:8,3:5))

Run the code above in your browser using DataLab