R/check_info_frac.R

Defines functions .check_info_frac

#' Check information fractions
#'
#' @param x Value to check.
#' @return \code{TRUE} invisibly; an error otherwise.
#' @noRd
.check_info_frac <- function(x) {
  if (!is.numeric(x) || length(x) < 1L || anyNA(x) || any(x <= 0) ||
      any(x > 1 + 1e-12) || (length(x) > 1L && any(diff(x) <= 0)) ||
      abs(x[length(x)] - 1) > 1e-10) {
    stop("'info_frac' must be strictly increasing, positive and end at 1.",
         call. = FALSE)
  }
  invisible(TRUE)
}

Try the DesignComplexSurvival package in your browser

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

DesignComplexSurvival documentation built on Nov. 23, 2026, 5:07 p.m.