R/totalLength.R

Defines functions totalLength

Documented in totalLength

##' Sum length of disjoint intervals
##'
##' 
##' @title totalLength
##' @param intervals 
##' @return Sum of lengths of disjoint intervals 
##' @author Spencer Woody
##'
##' @export
totalLength <- function(intervals) {
  sum(intervals[seq(2, length(intervals), by = 2)] -
        intervals[seq(1, length(intervals), by = 2)])
}
spencerwoody/saFAB documentation built on July 11, 2019, 8:21 p.m.