We can check the first 6 places, with substr
substr(a, 1, 6)== substr(b, 1, 6)
Or using sprintf
sprintf("%0.4f", a) == sprintf("%0.4f", b)
f1 <- function(v1, v2) {
sprintf("%0.4f", v1) == sprintf("%0.4f", v2)
}
f1(a, b)
f1(1.2345, 1.2346)
round, round
round(a, 4)
#[1] 1.2346
round(b, 4)
#[1] 1.2346
,