whichIs: Search values or patterns in a vector

View source: R/whichIS.R

whichIsR Documentation

Search values or patterns in a vector

Description

Search values or patterns in a vector.

Usage

whichIs(x, y, isPattern = FALSE, ...)

Arguments

x

a vector of values or patterns to be searched for.

y

a vector where x values are searched for.

isPattern

should x be considered as a vector of patterns?

...

further arguments to be passed to base::which().

Value

A list of positions. Each element corresponds to the matches for a specific x value.

Examples

vec <- LETTERS[1:10]
spl <- sample(vec)
id <- unlist(whichIs(vec, spl))
identical(vec, spl[id])

inSileco/letiRmisc documentation built on Sept. 16, 2022, 2:19 p.m.