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

whichAeqB

Index of a single match


Description

Return which(A %in% B) if it has length 1; give an error message otherwise.

Usage

whichAeqB(A, B, errNoMatch='no match',
                      err2Match='more than one match')

Arguments

A

A vector which may have a single match in B.

B

A vector of possible matches for A.

errNoMatch

a character string: error message if no match found.

err2Match

a character string: error message if multiple matches found.

Value

a single integer giving the index of the match in A.

Author(s)

Spencer Graves

See Also

Examples

a2b <- whichAeqB(letters, 'b')


all.equal(a2b, 2)

Ecfun

Functions for 'Ecdat'

v0.2-4
GPL (>= 2)
Authors
Spencer Graves <spencer.graves@effectivedefense.org>
Initial release
2020-10-26

We don't support your browser anymore

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