#' Minimum
#'
#' This function takes a single numeric vector and returns the minimum value in the vector.
#'
#' @param x Numeric vector of values
#'
#' @return Minimum value
#' @export
#'
#' @examples
#' x <- 1:10
#' minimum(x)
minimum <- function(x){
check_numeric_vector(x) # Check that the input is a single numeric vector
n <- length(x) # Number of elements in x
x_min <- x[1]
for (i in 2:n){
if (x[i] < x_min){
x_min <- x[i]
}
}
return(x_min)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.