Learn R Programming

taxonomizr (version 0.10.6)

topoSort: Combine multiple sorted vectors into a single sorted vector

Description

Combine multiple sorted vectors into a single vector assuming there are no cycles or weird topologies. Where a global position is ambiguous, the result is placed arbitrarily.

Usage

topoSort(vectors, maxIter = 1000, errorIfAmbiguous = FALSE)

Value

a vector with all unique elements sorted by the combined ordering provided by the input vectors

Arguments

vectors

A list of vectors each vector containing sorted elements to be merged into a global sorted vector

maxIter

An integer specifying the maximum number of iterations before bailing out. This should be unnecessary and is just a safety feature in case of some unexpected input or bug.

errorIfAmbiguous

If TRUE then error if any ambiguities arise

See Also

normalizeTaxa

Examples

Run this code
topoSort(list(c('a','b','f','g'),c('b','e','g','y','z'),c('b','d','e','f','y')))

Run the code above in your browser using DataLab