powered by
Closest(x, a, which = FALSE, na.rm = FALSE)
NA
which
set.seed(8) x <- sample(10, size=10, replace=TRUE) Closest(x, 6) Closest(x, 6, which=TRUE) Closest(c(2, 3, 4, 5), 3.5)
Run the code above in your browser using DataLab