Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

match

Split matching


Description

match() returns a vector of the positions of (first) matches of splits in its first argument in its second. %in% is a more intuitive interface as a binary operator, which returns a logical vector indicating whether there is a match or not for each split in its left operand.

Usage

match(x, table, ...)

## S3 method for class 'Splits'
match(x, table, ...)

## S3 method for class 'list'
match(x, table, ...)

x %in% table

## S3 method for class 'Splits'
x %in% table

in.Splits(x, table)

Arguments

x, table

Object of class Splits.

...

Specify nomatch = to provide an integer value that will be used in place of NA in the case where no match is found.

Details

in.Splits() is an alias for %in%, included for backwards compatibility. It will be deprecated in a future release.

Value

match() returns an integer vector specifying the position in table that matches each element in x, or nomatch if no match is found.

%in% returns a logical vector specifying which of the splits in x are present in table.

See Also

Corresponding base functions are documented in match().

Other Splits operations: LabelSplits(), NSplits(), NTip(), SplitFrequency(), SplitsInBinaryTree(), TipLabels(), TipsInSplits(), as.Splits()

Examples

splits1 <- as.Splits(BalancedTree(7))
splits2 <- as.Splits(PectinateTree(7))

match(splits1, splits2)
splits1 %in% splits2

TreeTools

Create, Modify and Analyse Phylogenetic Trees

v1.4.4
GPL (>= 3)
Authors
Martin R. Smith [aut, cre, cph] (<https://orcid.org/0000-0001-5660-1727>), Emmanuel Paradis [cph] (<https://orcid.org/0000-0003-3092-2199>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.