R/Mathematical_Functions.R

Defines functions whereNearest in_box

Documented in whereNearest

in_box <- function(xy, xbounds, ybounds, i_use) {
  !i_use &
  xy[, 1] >= xbounds[1] & xy[, 1] <= xbounds[2] &
  xy[, 2] >= ybounds[1] & xy[, 2] <= ybounds[2]
}





#' Index of the closest value in the matrix to the passed in value.
whereNearest <- function(val, matrix) {
  which.min(abs(matrix - val))
}
Burke-Lauenroth-Lab/SoilWat_R_Wrapper documentation built on Aug. 14, 2020, 5:17 p.m.