timeSeries-isRegular: Checks if a time series is regular

isRegularR Documentation

Checks if a time series is regular

Description

Checks if a time series is regular.

Usage

## S4 method for signature 'timeSeries'
isDaily(x)
## S4 method for signature 'timeSeries'
isMonthly(x)
## S4 method for signature 'timeSeries'
isQuarterly(x)

## S4 method for signature 'timeSeries'
isRegular(x)

## S4 method for signature 'timeSeries'
frequency(x, ...)

Arguments

x

an R object of class 'timeSeries'.

...

arguments to be passed.

Details

What is a regular time series? If a time series is daily, monthly, or weekly, then we speak of a regular series. This can be tested calling the functions isDaily, isMonthly, isQuarterly, or in general isRegular. If the series is regular then its frequency can be determined by calling frequency.

Here are the definitions of daily, monthly, and quarterly time series:

daily

if the series has no more than one date/time stamp per day.

monthly

if the series has no more than one date/time stamp per month.

quarterly

if the series has no more than one date/time stamp per quarter.

A regular series is either a monthly or a quarterly series.

Note that with the above definitions a monthly series is also a daily series, a quarterly series is also a monthly series. On the other hand, a daily series is not regular!

NOT yet implemented is the case of weekly series.

Value

The is* functions return TRUE or FALSE depending on whether the series fulfills the condition or not.

frequency returns in general 1, for quarterly series 4, and for monthly series 12.

See Also

isRegular frequency

Examples

data(MSFT)
isRegular(MSFT) # FALSE
frequency(MSFT) # 1

## a monthly ts
ap <- as.timeSeries(AirPassengers)
isRegular(ap) # TRUE
frequency(ap) # 12

## a quarterly ts
pres <- as.timeSeries(presidents)
isRegular(pres) # TRUE
frequency(pres) # 4

timeSeries documentation built on Jan. 13, 2024, 8:16 p.m.