R/get-max.r

Defines functions get_max.categorical get_max.continuous get_max

get_max <- function(x, observed = FALSE) {
  assert_that(is.flag(observed))
  
  UseMethod("get_max", x)
}

get_max.continuous <- function(object, observed = FALSE) {
  return (object$obs[length(object$obs)])
}

get_max.categorical <- function(object, observed = FALSE) {
  if(observed)
    return (object$obs[length(object$obs)])
  
  return (object$levels[length(object$levels)])
}
poissonconsulting/datalist documentation built on Feb. 18, 2021, 10:24 p.m.