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

1
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)/

Author(s)

Alexios Ghalanos

Examples

1
2
3
4
data(sp500ret)
Dates=rownames(sp500ret)
# create Monday dummy
monday=WeekDayDummy(Dates, date.format="%Y-%m-%d", weekday = "Monday")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.