Optimal Pairing and Matching via Linear Assignment
Apply all constraints to cost matrix
Apply caliper constraints
Apply maximum distance constraint
Apply scaling to matching variables
Apply weights to matching variables
Convert assignment result to a binary matrix
Assign blocks using clustering
Assign blocks based on grouping variable(s)
Solve assignment problem and return dual variables
Linear assignment solver
Augment Matching Results with Original Data (broom-style)
Generic Augment Function
Automatically encode categorical variables
Balance Diagnostics for Matched Pairs
Create Balance Table
Large value for forbidden pairs
Solve the Bottleneck Assignment Problem
Build cost matrix for matching
Calculate Variable-Level Balance Statistics
Check if parallel processing is available
Check cost distribution for problems
Check if full matching was achieved
Check variable health for matching
Compute pairwise distance matrix
Compute and Cache Distance Matrix for Reuse
Count valid pairs in cost matrix
Get a themed emoji
Info message with emoji
Couplr message helpers with emoji and humor
Stop with a fun, themed error message
Success message with emoji
Warn with a fun, themed warning message
couplr: Optimal Pairing and Matching via Linear Assignment
Detect and validate blocking
Diagnose distance matrix and suggest fixes
Invalid parameter error
Missing data error
Missing variables error
All pairs forbidden error
Example cost matrices for assignment problems
Example assignment problem data frame
Extract and standardize IDs from data frames
Extract matching variables from data frame
Filter blocks based on size and balance criteria
Standardize block ID column name
Extract method used from assignment result
Extract total cost from assignment result
Greedy match blocks in parallel
Greedy matching with blocking
Greedy Matching from Precomputed Distance Object
Greedy matching without blocking
Fast approximate matching using greedy algorithm
Re-export of dplyr::group_by
Check if data frame has blocking information
Check if any valid pairs exist
Low match rate info
Check if Object is a Distance Object
Check if object is a batch assignment result
Check if object is a k-best assignment result
Check if object is an assignment result
Join Matched Pairs with Original Data
Solve multiple assignment problems efficiently
Find k-best optimal assignments
Solve 1-D Line Assignment Problem
Solve linear assignment problems
Mark forbidden pairs
Match blocks in parallel
Match with blocking (multiple problems)
Match from Precomputed Distance Object
Match without blocking (single problem)
Optimal matching using linear assignment
Create blocks for stratified matching
Parallel lapply using future
Pipe operator
Pixel-level image morphing (animation)
Pixel-level image morphing (final frame only)
Plot method for balance diagnostics
Plot method for matching results
Preprocess matching variables with automatic checks and scaling
Print Method for Balance Diagnostics
Print Method for Distance Objects
Print method for batch assignment results
Print method for k-best assignment results
Print method for assignment results
Print method for matching results
Print method for matchmaker results
Print method for preprocessing result
Print method for variable health
Restore original parallel plan
Setup parallel processing with future
Round 'Sinkhorn' transport plan to hard assignment
'Sinkhorn-Knopp' optimal transport solver
Calculate Standardized Difference
Perfect balance success message
Suggest scaling method based on variable characteristics
Summarize block structure
Summary method for balance diagnostics
Summary Method for Distance Objects
Get summary of k-best results
Summary method for matching results
Update Constraints on Distance Object
Check if emoji should be used
Validate calipers parameter
Validate and prepare cost data
Validate matching inputs
Validate weights parameter
All distances identical warning
Constant variable warning
Extreme cost ratio warning
Many forbidden pairs warning
Too many zeros warning
Parallel package missing warning (reuse from matching_parallel.R)
High distance matches warning
Solves optimal pairing and matching problems using linear assignment algorithms. Provides implementations of the Hungarian method (Kuhn 1955) <doi:10.1002/nav.3800020109>, Jonker-Volgenant shortest path algorithm (Jonker and Volgenant 1987) <doi:10.1007/BF02278710>, Auction algorithm (Bertsekas 1988) <doi:10.1007/BF02186476>, cost-scaling (Goldberg and Kennedy 1995) <doi:10.1007/BF01585996>, scaling algorithms (Gabow and Tarjan 1989) <doi:10.1137/0218069>, push-relabel (Goldberg and Tarjan 1988) <doi:10.1145/48014.61051>, and Sinkhorn entropy-regularized transport (Cuturi 2013) <doi:10.48550/arxiv.1306.0895>. Designed for matching plots, sites, samples, or any pairwise optimization problem. Supports rectangular matrices, forbidden assignments, data frame inputs, batch solving, k-best solutions, and pixel-level image morphing for visualization. Includes automatic preprocessing with variable health checks, multiple scaling methods (standardized, range, robust), greedy matching algorithms, and comprehensive balance diagnostics for assessing match quality using standardized differences and distribution comparisons.
Useful links