greedy: Greedy one-to-one matching of pairs

View source: R/greedy.R

greedyR Documentation

Greedy one-to-one matching of pairs

Description

Greedy one-to-one matching of pairs

Usage

greedy(x, y, weight, n = 1L, m = 1L, include_ties = FALSE)

Arguments

x

id's of lhs of pairs; converted to integer

y

id's of rhs of pairs; converted to integer

weight

numeric vector with weight of pair

n

an integer. Each element of x can be linked to at most n elements of y.

m

an integer. Each element of y can be linked to at most m elements of x.

include_ties

when pairs for a given record have an equal weight, should all pairs be included.

Details

Pairs with the highest weight are selected as long a neither the lhs as the rhs are already selected in a pair with a higher weight. When include_ties is TRUE all pairs are included when multiple pairs for a given record have an equal weight.

Value

A logical vector with the same length as x.


reclin2 documentation built on May 29, 2024, 4:21 a.m.