findThem: Find values in a given vector

View source: R/findThem.R

findThemR Documentation

Find values in a given vector

Description

Given a set of values and a vector where the values must be found, findThem records the matched values and the position in the vector where the values have been searched for.

Usage

findThem(what, where, todf = FALSE, reportnomatch = FALSE)

Arguments

what

a vector a values to be searched for.

where

a vector where values will be searched on.

todf

a logical. Should the output object must be a data frame?

reportnomatch

a logical. If TRUE, values without match are reported #' in the data frame with a NA. Only available if todf is TRUE (default is FALSE).

Value

A list indicating matched positions for each elements of what. If no match is found then NA is returned. If todf is TRUE then a three-columns data frame is returned including values and positions in both what and where vectors.

See Also

which()

Examples

x <- stats::rpois(1000,10)
findThem(c(10,4,100), x)
findThem(c(10,4,100), x, todf=TRUE)
findThem(c(10,4,100), x, todf=TRUE, reportnomatch=TRUE)

inSileco/inSilecoMisc documentation built on Sept. 14, 2022, 5:44 a.m.