[R] The effect of tolerance in all.equal()

Ashim Kapoor ashimkapoor at gmail.com
Tue Apr 25 10:32:18 CEST 2017


Dear all,

I am not able to understand the interplay of absolute vs relative and
tolerance in the use of all.equal

If I want to find out if absolute differences between 2 numbers/vectors are
bigger than a given tolerance I would do:

all.equal(1,1.1,scale=1,tol= .1)

If I want to find out if relative differences between 2 numbers/vectors are
bigger than a given tolerance I would do :

all.equal(1,1.1,tol=.1)

##################################################################################################################################

I can also do :

all.equal(1,3,tol=1)

to find out if the absolute difference is bigger than 1.But here I won't be
able to detect absolute differences smaller than 1 in this case,so I don't
think that this is a good way.

My query is: what is the reasoning behind all.equal returning the absolute
difference if the tolerance >= target and relative difference if tolerance
< target?

Best Regards,
Ashim

	[[alternative HTML version deleted]]



More information about the R-help mailing list