View source: R/balance_around.R
ranked_sort | R Documentation |
For two sets of unique identifiers, given each member's ranked preference for every member of the other set, find optimal pairings. The two sets are referred to as match_to
and match_from
. All the members of match_to
will be paired to members of match_from
, but if there are more members of match_from
than match_to
there will be unpaired, discarded members of match_from
. The inputs are two data frames, one where each observation is a unique combination of each member of match_to
and match_from
and the preference of that match_to
member for match_from
, numeric with lower values treated as more preferred. The other data frame contains the preferences of the match_from
members for match_to
members.
ranked_sort( match_to, match_from, match_to_idvar = "match_to_id", match_from_idvar = "match_from_id", match_to_rankvar = "match_to_rank", match_from_rankvar = "match_from_rank", iteration_limit = 5000 )
match_to |
Data frame. The preferences of the members of the set to match to for the members of the set to match from. There must be one observation for each unique pairing between the two sets. The variable |
match_from |
Data frame. The preferences of the members of the set to match from for the members of the set to match to. There must be one observation for each unique pairing between the two sets. The variable |
match_to_idvar |
Character string. The name of the variable in both |
match_from_idvar |
Character string. The name of the variable in both |
match_to_rankvar |
Character string. The name of the variable in |
match_from_rankvar |
Character string. The name of the variable in |
iteration_limit |
Numeric. The maximum number of iterations to attempt to sort before giving up. Defaults to |
A data frame with the variables match_to_id
and match_from_id
containing the paired members of the two sets.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.