match_within_tolerance: Helper Function for Value Matching with Tolerance

View source: R/helpers.R

match_within_toleranceR Documentation

Helper Function for Value Matching with Tolerance

Description

[Stable]

This is a modified version of match() that supports tolerance.

Usage

match_within_tolerance(x, table, tolerance = 1e-10)

Arguments

x

(numeric)
the values to be matched.

table

(numeric)
the values to be matched against.

tolerance

(number)
the numerical tolerance for comparison.

Value

An integer vector of the same length as x giving the position in table of the first match, or an empty integer vector if table is empty. NA is returned for values in x that have no match.

Examples

match_within_tolerance(c(0.1, 0.2, 0.3), c(0.10000001, 0.5, 0.3))
match_within_tolerance(1.5, numeric(0))

crmPack documentation built on Nov. 29, 2025, 5:07 p.m.