couplr1.0.10 package

Optimal Pairing and Matching via Linear Assignment

apply_all_constraints

Apply all constraints to cost matrix

apply_calipers

Apply caliper constraints

apply_max_distance

Apply maximum distance constraint

apply_scaling

Apply scaling to matching variables

apply_weights

Apply weights to matching variables

as_assignment_matrix

Convert assignment result to a binary matrix

assign_blocks_cluster

Assign blocks using clustering

assign_blocks_group

Assign blocks based on grouping variable(s)

assignment_duals

Solve assignment problem and return dual variables

assignment

Linear assignment solver

augment.matching_result

Augment Matching Results with Original Data (broom-style)

augment

Generic Augment Function

auto_encode_categorical

Automatically encode categorical variables

balance_diagnostics

Balance Diagnostics for Matched Pairs

balance_table

Create Balance Table

BIG_COST

Large value for forbidden pairs

bottleneck_assignment

Solve the Bottleneck Assignment Problem

build_cost_matrix

Build cost matrix for matching

calculate_var_balance

Calculate Variable-Level Balance Statistics

can_parallelize

Check if parallel processing is available

check_cost_distribution

Check cost distribution for problems

check_full_matching

Check if full matching was achieved

check_variable_health

Check variable health for matching

compute_distance_matrix

Compute pairwise distance matrix

compute_distances

Compute and Cache Distance Matrix for Reuse

count_valid_pairs

Count valid pairs in cost matrix

couplr_emoji

Get a themed emoji

couplr_inform

Info message with emoji

couplr_messages

Couplr message helpers with emoji and humor

couplr_stop

Stop with a fun, themed error message

couplr_success

Success message with emoji

couplr_warn

Warn with a fun, themed warning message

couplr-package

couplr: Optimal Pairing and Matching via Linear Assignment

detect_blocking

Detect and validate blocking

diagnose_distance_matrix

Diagnose distance matrix and suggest fixes

err_invalid_param

Invalid parameter error

err_missing_data

Missing data error

err_missing_vars

Missing variables error

err_no_valid_pairs

All pairs forbidden error

example_costs

Example cost matrices for assignment problems

example_df

Example assignment problem data frame

extract_ids

Extract and standardize IDs from data frames

extract_matching_vars

Extract matching variables from data frame

filter_blocks

Filter blocks based on size and balance criteria

get_block_id_column

Standardize block ID column name

get_method_used

Extract method used from assignment result

get_total_cost

Extract total cost from assignment result

greedy_blocks_parallel

Greedy match blocks in parallel

greedy_couples_blocked

Greedy matching with blocking

greedy_couples_from_distance

Greedy Matching from Precomputed Distance Object

greedy_couples_single

Greedy matching without blocking

greedy_couples

Fast approximate matching using greedy algorithm

group_by

Re-export of dplyr::group_by

has_blocks

Check if data frame has blocking information

has_valid_pairs

Check if any valid pairs exist

info_low_match_rate

Low match rate info

is_distance_object

Check if Object is a Distance Object

is_lap_solve_batch_result

Check if object is a batch assignment result

is_lap_solve_kbest_result

Check if object is a k-best assignment result

is_lap_solve_result

Check if object is an assignment result

join_matched

Join Matched Pairs with Original Data

lap_solve_batch

Solve multiple assignment problems efficiently

lap_solve_kbest

Find k-best optimal assignments

lap_solve_line_metric

Solve 1-D Line Assignment Problem

lap_solve

Solve linear assignment problems

mark_forbidden_pairs

Mark forbidden pairs

match_blocks_parallel

Match blocks in parallel

match_couples_blocked

Match with blocking (multiple problems)

match_couples_from_distance

Match from Precomputed Distance Object

match_couples_single

Match without blocking (single problem)

match_couples

Optimal matching using linear assignment

matchmaker

Create blocks for stratified matching

parallel_lapply

Parallel lapply using future

pipe

Pipe operator

pixel_morph_animate

Pixel-level image morphing (animation)

pixel_morph

Pixel-level image morphing (final frame only)

plot.balance_diagnostics

Plot method for balance diagnostics

plot.matching_result

Plot method for matching results

preprocess_matching_vars

Preprocess matching variables with automatic checks and scaling

print.balance_diagnostics

Print Method for Balance Diagnostics

print.distance_object

Print Method for Distance Objects

print.lap_solve_batch_result

Print method for batch assignment results

print.lap_solve_kbest_result

Print method for k-best assignment results

print.lap_solve_result

Print method for assignment results

print.matching_result

Print method for matching results

print.matchmaker_result

Print method for matchmaker results

print.preprocessing_result

Print method for preprocessing result

print.variable_health

Print method for variable health

restore_parallel

Restore original parallel plan

setup_parallel

Setup parallel processing with future

sinkhorn_to_assignment

Round 'Sinkhorn' transport plan to hard assignment

sinkhorn

'Sinkhorn-Knopp' optimal transport solver

standardized_difference

Calculate Standardized Difference

success_good_balance

Perfect balance success message

suggest_scaling

Suggest scaling method based on variable characteristics

summarize_blocks

Summarize block structure

summary.balance_diagnostics

Summary method for balance diagnostics

summary.distance_object

Summary Method for Distance Objects

summary.lap_solve_kbest_result

Get summary of k-best results

summary.matching_result

Summary method for matching results

update_constraints

Update Constraints on Distance Object

use_emoji

Check if emoji should be used

validate_calipers

Validate calipers parameter

validate_cost_data

Validate and prepare cost data

validate_matching_inputs

Validate matching inputs

validate_weights

Validate weights parameter

warn_constant_distance

All distances identical warning

warn_constant_var

Constant variable warning

warn_extreme_costs

Extreme cost ratio warning

warn_many_forbidden

Many forbidden pairs warning

warn_many_zeros

Too many zeros warning

warn_parallel_unavailable

Parallel package missing warning (reuse from matching_parallel.R)

warn_poor_quality

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.

  • Maintainer: Gilles Colling
  • License: MIT + file LICENSE
  • Last published: 2026-01-21