R/calcMidpoints.R

Defines functions calcMidpoints

Documented in calcMidpoints

#' 
#' @title Calculate midpoints from a vector ofcuutpoints 
#' @description Funciton to calculate midpoints from a vector ofcuutpoints 
#' @param x - numeric vector of cutpoints 
#' @return vector of midpoints (length = length(x)-1)
#' @details calculates the arithmetic midpoints of the successive intervals 
#' defined by x.
#' @export
calcMidpoints<-function(x){
    y = x[1:(length(x)-1)] + base::diff(x,1)/2;
    return(y);
}
wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.