R: Intervals between dates

estimate.time.scale {bsts} | R Documentation

## Intervals between dates

### Description

Estimate the time scale used in time series data.

### Usage

    EstimateTimeScale(dates)

### Arguments

`dates` | A sorted vector of class `Date`.

### Value

A character string. Either "daily", "weekly", "yearly", "monthly", "quarterly", or "other". The value is determined based on counting the number of days between successive observations in `dates`.

### Author(s)

Steven L. Scott steve.the.bayesian@gmail.com

### Examples

    weekly.data <- as.Date(c("2011-10-01",
                             "2011-10-08",
                             "2011-10-15",
                             "2011-10-22",
                             "2011-10-29",
                             "2011-11-05"))

    EstimateTimeScale(weekly.data) # "weekly"

    almost.weekly.data <- as.Date(c("2011-10-01",
                                    "2011-10-08",
                                    "2011-10-15",
                                    "2011-10-22",
                                    "2011-10-29",
                                    "2011-11-06"))  # last day is one later

    EstimateTimeScale(weekly.data) # "other"

[Package bsts version 0.9.6 Index]