pick_more_precise {broman}R Documentation

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

Description

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.

Usage

pick_more_precise(x, y, tol = 0.000001)

Arguments

x

A numeric vector

y

A second numeric vector

tol

Tolerance for differences between the values

Details

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.

Value

A vector of combined values


[Package broman version 0.84 Index]