| rowmatch | R Documentation |
rowmatch and row.match return a vector of the positions of
(first) row matches of its first argument in its second.
%rowin% and %row.in% are more intuituve interfaces as
binary operator, which return a logical vector indicating if there is a row
match or not for its left operand.
rowmatch(x, table, nomatch = NA_integer_, incomparables = NULL)
x %rowin% table
row.match(x, table, nomatch = NA_integer_, incomparables = NULL)
## S4 method for signature 'data.frame,data.frame'
row.match(x, table, nomatch = NA_integer_, incomparables = NULL)
## S4 method for signature 'data.frame,ANY'
row.match(x, table, nomatch = NA_integer_, incomparables = NULL)
## S4 method for signature 'ANY,data.frame'
row.match(x, table, nomatch = NA_integer_, incomparables = NULL)
x %row.in% table
## specifically for row matching data frames
row.match.data.frame(x, table, nomatch = NA_integer_, incomparables = NULL)
x |
vector, matrix, array, data.frame or |
table |
vector, matrix, array, data.frame or |
nomatch |
the value to be returned in the case when no row match is
found. Note that it is coerced to |
incomparables |
a vector, matrix, array or data.frame of rows that
cannot be matched. Any row in |
%rowin% and %row.in% are currently defined as
"%rowin%" <- function(x, table) rowmatch(x, table, nomatch = 0) > 0
"%row.in%" <- function(x, table) row.match(x, table, nomatch = 0) > 0
rowmatch is intended for matrix-like objects including vectors,
matrices, and arrays. Data frames are coerced to arrays.
Similar to row.names being generic with rownames
as the default method, row.match is generic with rowmatch as
the default method.
row.match.data.frame is the method used for row.match when one
of x, table and incomparables is a data frame. It is
available incase you want to call it directly. Instead of coercing to arrays,
it coerces to data frames.
That %rowin% and %row.in% never return NA makes them
particularly useful in if conditions.
A vector of the same length as the number of rows in x.
rowmatch and row.match: An integer vector giving the row
position in table of the first row match if there is a row match,
otherwise nomatch.
If the i-th row of x is found to equal the j-th row of
table then the value returned in the i-th position of the
return value is j, for the smallest possible j. If no match is
found, the value is nomatch.
%rowin% and %row.in%: A logical vector, indicating if a row
match was located for each row of x: thus the values are TRUE
or FALSE and never NA.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.