R/translate_extrema.R

Defines functions translate_MAX translate_MIN translate_extrema

translate_extrema <- function(equation) {
  translate_MIN(equation) %>%
    translate_MAX()
}

translate_MIN <- function(equation) {
  pattern <- stringr::regex("\\bMIN\\b", ignore_case = TRUE)
  stringr::str_replace_all(equation, pattern, "min")
}

translate_MAX <- function(equation) {
  pattern <- stringr::regex("\\bMAX\\b", ignore_case = TRUE)
  stringr::str_replace_all(equation, pattern, "max")
}

Try the readsdr package in your browser

Any scripts or data that you put into this service are public.

readsdr documentation built on Jan. 13, 2021, 11:08 a.m.