pick_more_precise: Pick the more precise value for each element in two related...

View source: R/pick_more_precise.R

pick_more_preciseR Documentation

Pick the more precise value for each element in two related vectors


Align two vectors of numbers by their names and then pick a single value from each, favoring the more precise one. If the two values differ by more than round-off error, treat the value as missing.


pick_more_precise(x, y, tol = 0.000001)



A numeric vector


A second numeric vector


Tolerance for differences between the values


Okay, this is a bit weird. But suppose you have two columns of numbers that have been subjected to different quirky rounding patterns. We align the vectors using their names and then for each element we pick between the two choices, favoring the more-precise one. If one is missing, choose the non-missing value. If the two differ by more than the round-off error, treat it as missing.


A vector of combined values

broman documentation built on July 8, 2022, 5:07 p.m.