Learn R Programming

timeSeries (version 4041.111)

isRegular: Checks if a time series is regular

Description

Checks if a time series is regular.

Usage

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

# S4 method for timeSeries isRegular(x)

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

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.

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.

See Also

Examples

Run this code
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

Run the code above in your browser using DataLab