R/cap.R

Defines functions cap_15 cap_3 cap

Documented in cap cap_15 cap_3

#' Caption for dry period and min_thresh
#'
#' @importFrom glue glue
#' @export

cap = function(n_dry = NULL, daily_thresh = NULL){

  for(i in c(n_dry, daily_thresh)) {
    if(is.null(i)){
      stop(paste0(i, " cannot be NULL"))
    }
  }

  s = glue("Dry Period: {n_dry} <br> Daily Threshold {daily_thresh}")
  return(s)

}

#' p3 string
#' @export
cap_3 = function(md = T) {
  if (md) {
    s = "**p3** (precipitation three days before landslide) [mm]"
    return(s)
  } else{
    s = "p3 (precipitation three days before landslide) [mm]"
  }
}

#' p3 string
#' @export
cap_15 = function(md = T) {
  if (md) {
    s = "**p15** (precipitation 15 days prior to p3) [mm]"
    return(s)
  } else{
    s = "p15 (precipitation 15 days prior to p3) [mm]"
  }
}
MaThRk/help documentation built on Dec. 17, 2021, 2:14 a.m.