Learn R Programming

crmPack (version 2.0.0)

match_within_tolerance: 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)

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.

Arguments

x

(numeric)
the values to be matched.

table

(numeric)
the values to be matched against.

tolerance

(number)
the numerical tolerance for comparison.

Examples

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

Run the code above in your browser using DataLab