rowmatch {docopulae} | R Documentation |
Row Matching
Description
rowmatch
returns a vector of the positions of (first) matches of the rows of its first argument in the rows of its second.
Usage
rowmatch(x, table, nomatch = NA_integer_)
Arguments
x |
a row matrix of doubles, the rows to be matched. |
table |
a row matrix of doubles, the rows to be matched against. |
nomatch |
the value to be returned in the case when no match is found.
Note that it is coerced to |
Details
rowmatch
uses compiled C-code.
Value
rowmatch
returns an integer vector giving the position of the matching row in table
for each row in x
. And nomatch
if there is no matching row.
See Also
Examples
a = as.matrix(expand.grid(as.double(2:3), as.double(3:6)))
a = a[sample(nrow(a)),]
a
b = as.matrix(expand.grid(as.double(3:4), as.double(2:5)))
b = b[sample(nrow(b)),]
b
i = rowmatch(a, b)
i
b[na.omit(i),] # matching rows
a[is.na(i),] # non matching rows
[Package docopulae version 0.4.0 Index]