powered by
Given a number x and a numeric vector vec, what's the closest value to x in vec?
x
vec
Closest(x, vec, index = FALSE)
A number.
A numeric vector.
If set to TRUE, return the index (rather than the value) of the closest element.
TRUE
# NOT RUN { Closest(pi, 0:10) Closest(pi, 0:10, index = TRUE) # }
Run the code above in your browser using DataLab