greedy function

Greedy one-to-one matching of pairs

Greedy one-to-one matching of pairs

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.

Returns

A logical vector with the same length as x.

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.

  • Maintainer: Jan van der Laan
  • License: GPL-3
  • Last published: 2024-02-09