R/pw_value.R

Defines functions .pw_value

#' Value of a piecewise constant function
#'
#' @param x Evaluation points (nonnegative).
#' @param time Interval start times (first value 0, increasing).
#' @param value Values in each interval (same length as \code{time}).
#' @return Values at \code{x}; intervals are closed on the left.
#' @noRd
.pw_value <- function(x, time, value) {
  value[pmax(findInterval(x, time), 1L)]
}

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.