fac.match {dae} | R Documentation |
Match, for each combination of a set of columns in x
, the row that has the same combination in table
Description
Match, for each combination of a set of columns in x
,
the rows that has the same combination in table
.
The argument multiples.allow
controls what happens when there are
multple matches in table
of a combination in x
.
Usage
fac.match(x, table, col.names, nomatch = NA_integer_, multiples.allow = FALSE)
Arguments
x |
an R object, normally a |
table |
an R object, normally a |
col.names |
A |
nomatch |
The value to be returned in the case when no match is found. Note that it is coerced to integer. |
multiples.allow |
A |
Value
A vector
of length equal to x
that gives the
rows in table
that match the combinations of
col.names
in x
. The order of the rows is the same as
the order of the combintions in x
. The value returned if a combination is
unmatched is specified in the nomatch
argument.
Author(s)
Chris Brien
See Also
Examples
## Not run:
#A single unmatched combination
kdata <- data.frame(Expt="D197-5",
Row=8,
Column=20, stringsAsFactors=FALSE)
index <- fac.match(kdata, D197.dat, c("Expt", "Row", "Column"))
# A matched and an unmatched combination
kdata <- data.frame(Expt=c("D197-5", "D197-4"),
Row=c(8, 10),
Column=c(20, 8), stringsAsFactors=FALSE)
index <- fac.match(kdata, D197.dat, c("Expt", "Row", "Column"))
## End(Not run)