Learn R Programming

nbpMatching (version 1.5.6)

nonbimatch: Nonbipartite Matching

Description

The nonbinmatch function creates the set of pairwise matches that minimizes the sum of distances between the pairs.

Usage

nonbimatch(mdm, threshold = NA, precision = 6, ...)

Value

nonbimatch S4 object with several elements

matches

data.frame containing matches

halves

data.frame containing each match

total

sum of the distances across all pairs

mean

mean distance for each pair

Arguments

mdm

A distancematrix object. See the distancematrix function.

threshold

An numeric value, indicating the distance needed to create chameleon matches.

precision

The largest value in the matrix will have at most this many digits. The default value is six.

...

Additional arguments, these are not used.

Author

Cole Beck

Details

The nonbinmatch function calls the Fortran code (Derigs) and set of pairwise matches that minimizes the sum of distances between the pairs.

See Also

distancematrix

Examples

Run this code

plainmatrix<-as.matrix(dist(sample(1:25, 8, replace=TRUE)))
diag(plainmatrix) <- 99999  # setting diagonal to an infinite distance for
                           # pedagogical reasons (the diagonal may be left
                           # as zero)
mdm<-distancematrix(plainmatrix)
res<-nonbimatch(mdm)

Run the code above in your browser using DataLab