This function takes the a data set data
. Assuming the data
has a column with the name stored in the group
argument
indicating the groups (see groupby
), and a
column with the count
variable that ranks the elements in the
group (data is assumed to be ordered by (group, rank)
); this
function returns a dummy indicator for each row in data
that
equals to 1 if the count
entry matches that of type
,
which can either be max
or min
(i.e. either the
largest in the group, or the smallest).
maxminmatch(data, count = ".mst.monoc", group = ".mst.monog", type)
data.frame
that user wishes to determine the row
with the largest or smallest ranking within each group.
string of column name indicating the ranking of each row within a group.
string of column name indicating the group of each row.
input "max"
to tag the row in each group with
the largest rank, and "min"
to tag the row in each group
with the smallest rank.
A binary vector indicating whether or not each
corresponding row in data
is the max/min within its
group.