#' Find nearest value
#'
#' Finds element of vector which is nearest to a given constant
#'
#' @param vec A vector
#' @param constant A numeric, default is 0
#'
#'
#' @export
#'
nearest <- function(vec, constant = 0){
return(which.min(abs(vec - constant)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.