firstmatch {exams.forge}R Documentation

Firstmatch

Description

firstmatch seeks matches for the elements of its first argument among those of its second. For further details please check base::charmatch(). charmatch returns a zero if multiple matches are found, whereas firstmatch returns the first partial match if multiple matches are found.

Usage

firstmatch(x, table, nomatch = NA_integer_)

Arguments

x

character: the values to be matched; converted to a character vector if necessary

table

character: the values to be matched against; converted to a character vector if necessary

nomatch

integer: the value to be returned at non-matching positions (default: NA_integer_)

Value

An integer.

Examples

firstmatch("d", c("chisq", "cauchy"))
charmatch("c", c("chisq", "cauchy"))
firstmatch("c", c("chisq", "cauchy"))
firstmatch("ca", c("chisq", "cauchy"))

[Package exams.forge version 1.0.10 Index]