#' get valley position
#'
#' @param curve
#' @param x
#'
#' @return
#' @export
#'
#' @examples
get.valley <- function(curve, x = seq_along(curve)) {
#Ver 3.4.1
curve.min <- min(curve)
len = length(curve)
if (len == 1)
return (NULL)
if (curve.min == curve[len])
return(get.valley(curve[1:len - 1], x[1:len - 1]))
if (curve.min == curve[1])
return(get.valley(curve[2:len], x[2:len]))
return(x[which(curve == curve.min)])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.