detectdst: DST and Leap year detector functions

View source: R/detector-dst-leap.R

detectdstR Documentation

DST and Leap year detector functions

Description

Functions to detect, when Daylight Saving Time and leap year start and finish

Usage

detectdst(object)

detectleap(object)

Arguments

object

Either a zoo / xts object or a vector of dates / times in POSIXt / Date class. Note that in order for detectdst() to work correctly, your data should not have missing observations. Otherwise it might not be possible to locate, when DST happens.

Details

The detectdst function detects, when the change for the DST starts and ends. It assumes that the frequency of data is not lower than hourly. The detectleap function does similar for the leap year, but flagging the 29th of February as a starting and to the 28th of February next year as the ending dates.

In order for the methods to work, the object needs to be of either zoo / xts or POSIXt class and should contain valid dates.

Value

List containing:

  • start - data frame with id (number of observation) and the respective dates, when the DST / leap year start;

  • end - data frame with id and dates, when DST / leap year end.

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

See Also

xregExpander, temporaldummy, outlierdummy

Examples

# Generate matrix with monthly dummies for a zoo object
x <- as.POSIXct("2004-01-01")+0:(365*24*8)*60*60
detectdst(x)
detectleap(x)


config-i1/greybox documentation built on Dec. 12, 2024, 1:42 p.m.