Learn R Programming

tsaux (version 1.0.0)

sampling_frequency: Infers the sampling frequency of a time series

Description

Given either a vector of time indices or an xts object will infer the sampling frequency.

Usage

sampling_frequency(x)

Value

the sampling period (character).

Arguments

x

either an xts object (or one which has an index attribute) else a vector of class Date or POSIX based time index

Examples

Run this code
w <- sampling_frequency(seq(as.Date("2010-01-01"), as.Date("2011-01-01"), by="weeks"))
m <- sampling_frequency(seq(as.POSIXct("2010-01-01 12:00:00"),
as.POSIXct("2010-01-02 12:00:00"), by="15 mins"))

Run the code above in your browser using DataLab