Learn R Programming

scanstatistics (version 1.1.1)

has_converged: Is the relative error between two numbers is less than the given tolerance?

Description

Given two consecutive numbers in a sequence, return TRUE if the relative change is positive but less than the given tolerance.

Usage

has_converged(current, previous, tol = 0.01)

Arguments

current

A scalar; the most recent value of the sequence.

previous

A scalar; the second most recent value of the sequence, or a reference value.

tol

The tolerance, a positive scalar near zero.