R/minmax.R

Defines functions minmax

Documented in minmax

#' @title Minimum-Maximum of Object
#'
#' @description Function to get min and max for a bunch of objects (all coerced to vectors) to set xlim and ylim in plot
#'
#' @param ... Objects to determine min-max
#' @param na.rm Should NA be removed?
#'
#' @export

minmax <- function(..., na.rm=TRUE) {

  a <- numeric(0)
  things <- list(...)
  for(i in 1:length(things)) {
    a <- c(a, as.vector(things[[i]]))
  }
  return(c(min(a, na.rm=na.rm), max(a, na.rm = na.rm)))
}
mattwarkentin/sandbox documentation built on Jan. 29, 2020, 4:46 p.m.