match.split | R Documentation |
Given a set of values and a grouped vector x
, find parallel matches of each value in the different groups and return their positions in the original vector x
. If there are multiple matches of the same value in a group, only the position of the first match is returned.
match.split(x, f, values=NULL, groups=NULL, nomatch=NA_integer_)
x |
vector to be divided into groups and matched against |
f |
a factor that defines the grouping (or a vector that can be converted to a factor) |
values |
values to be matched in |
groups |
a character vector listing the set of groups to be formed. Defaults to the levels of |
nomatch |
the value to be returned in cases where no match is found (coerced to an integer) |
An integer matrix with one row for each value (in values
) and one column for each group (in groups
), specifying the index in x
of the first match of a value within the respective group. If not match is found for a given combination of value and group, nomatch
is inserted (defaults to NA
).
Stephanie Evert (https://purl.org/stephanie.evert)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.