TITLE(match @@ Value Matching)
USAGE(
match(x, table, nomatch=NA)
)
ALIAS(match)
ARGUMENTS(
ARG(x @@ the values to be matched.)
ARG(table @@ the values to be matched against.)
ARG(nomatch @@ the value to be returned in the case when no match is found.))
DESCRIPTION(
If LANG(x[i]) is found to equal LANG(table[j])
then the value returned in the LANG(i)-th position of the return value is
LANG(j).
If no match is found, the value is LANG(nomatch).
)
SEEALSO(
LANG(LINK(pmatch)) for ITALIC(partial) string matching.
)
EXAMPLES(
"%in%" <- function(a, b) !is.na(match(a, b))#- following John Wallace
1:10 %in% c(1,3,5,9)
codes <- c("c","ab","B","bba","c","@","bla","a","Ba","%")
codes[codes %in% c(letters,LETTERS)]
BLANK
## The intersection of two sets :
intersect <- function(x, y) y[match(x, y, nomatch = 0)]
intersect(1:10,7:20)
)
