pick_more_precise {broman} | R Documentation |
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)
x |
A numeric vector |
y |
A second numeric vector |
tol |
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