Learn R Programming

xts (version 0.13.0)

ndays: Number of Periods in Data

Description

Calculate the number of specified periods in a given time series like data object.

Usage

nseconds(x)
nminutes(x)
nhours(x)
ndays(x)
nweeks(x)
nmonths(x)
nquarters(x)
nyears(x)

Value

The number of observations for the period type specified

Arguments

x

A time-based object

Author

Jeffrey A. Ryan

Details

Essentially a wrapper to endpoints with the appropriate period specified; the resulting value derived from counting the endpoints

As a compromise between simplicity and accuracy, the results will always round up to the nearest complete period. So n**** - 1 will return the completed periods.

For finer grain detail one should call a higher frequency n**** function.

An alternative summary can be found with periodicity and unclass(periodicity(x)).

See Also

endpoints

Examples

Run this code
if (FALSE) {
getSymbols("QQQQ")

ndays(QQQQ)
nweeks(QQQQ)
}

Run the code above in your browser using DataLab