Skip to contents

Get the duration of time series or intervals.

Usage

span(x, ...)

# S4 method for class 'TimeSeries'
span(x, calendar = NULL)

# S4 method for class 'TimeIntervals'
span(x, calendar = NULL)

Arguments

x

A TimeSeries or a TimeIntervals object.

...

Currently not used.

calendar

A TimeScale object specifying the target calendar (see calendar()). If NULL (the default), rata die are returned.

Value

A numeric vector of years.

See also

Other tools: overlap(), start(), time(), window()

Author

N. Frerebeau

Examples

## Create time intervals
int <- intervals(
  start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200,
            1325, 1375, 1200, 1300, 1375, 1275, 1325),
  end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325,
          1400, 1500, 1300, 1375, 1500, 1325, 1425),
  calendar = CE()
)

## Get time durations
span(int, calendar = CE())
#>  [1] 125 125  50  50  75 200 300 125  75 125 100  75 125  50 100