Learn R Programming

rugarch (version 1.0-16)

WeekDayDummy-methods: function: Create Dummy Day-of-Week Variable

Description

Helper function to create a dummy, day of the week variable given a set of dates.

Usage

WeekDayDummy(Dates, date.format, weekday = "Monday")

Arguments

Dates
A character vector of dates .
date.format
The format of the dates e.g. %Y-%m-%d" .
weekday
Character string indicating day of week.

Value

  • A numeric vector of 0s and 1s (date-dummy variable)/

Examples

Run this code
data(sp500ret)
Dates=rownames(sp500ret)
# create Monday dummy
monday=WeekDayDummy(Dates, date.format="%Y-%m-%d", weekday = "Monday")

Run the code above in your browser using DataLab