DataFramesMeta.jl
DataFramesMeta.jl copied to clipboard
@rsubset Float64 values without using tolerance
This code is working:
tolerance = 1e-4
zvalue = @chain dtd_new_5g begin
@rsubset(abs(:latitude - 26.0846) < tolerance, abs(:longitude - 86.1236) < tolerance)
end
But how can I make it work without using tolerance and absolute values?"
You probably want isapprox (a built-in Julia function)
isapprox(x, y; atol::Real=0, rtol::Real=atol>0 ? 0 : √eps, nans::Bool=false[, norm::Function])
Inexact equality comparison. Two numbers compare equal if their
relative distance or their absolute distance is within tolerance
bounds: isapprox returns true if norm(x-y) <= max(atol,
rtol*max(norm(x), norm(y))). The default atol (absolute tolerance) is
zero and the default rtol (relative tolerance) depends on the types of
x and y. The keyword argument nans determines whether or not NaN values
are considered equal (defaults to false).
For real or complex floating-point values, if an atol > 0 is not
specified, rtol defaults to the square root of eps of the type of x or
y, whichever is bigger (least precise). This corresponds to requiring
equality of about half of the significant digits. Otherwise, e.g. for
integer arguments or if an atol > 0 is supplied, rtol defaults to zero.