R/span.R

# SPAN
#' @include AllGenerics.R
NULL

#' @export
#' @rdname span
#' @aliases span,TimeSeries-method
setMethod(
  f = "span",
  signature = c(x = "TimeSeries"),
  definition = function(x, calendar = NULL) {
    z <- end(x, calendar = calendar) - start(x, calendar = calendar)
    unclass(z) * calendar_direction(calendar)
  }
)

#' @export
#' @rdname span
#' @aliases span,TimeIntervals-method
setMethod(
  f = "span",
  signature = c(x = "TimeIntervals"),
  definition = function(x, calendar = NULL) {
    z <- end(x, calendar = calendar) - start(x, calendar = calendar)
    unclass(z) * calendar_direction(calendar)
  }
)

Try the aion package in your browser

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

aion documentation built on Oct. 4, 2024, 5:07 p.m.