Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

calendar-isWeekday

Weekdays and Weekends


Description

Tests if a date is a weekday or not.

Usage

isWeekday(x, wday = 1:5)
isWeekend(x, wday = 1:5)

Arguments

x

an object of class timeDate.

wday

Specify which days should be considered as weekdays. By default from Mondays to Fridays.

Value

the functions return logical vectors indicating if a date is a weekday, or a weekend day.

Examples

## Dates in April, currentYear:
   currentYear = getRmetricsOptions("currentYear")
   tS = timeSequence(
      from = paste(currentYear, "-03-01", sep = ""),
      to = paste(currentYear, "-04-30", sep = ""))
   tS

## Subset of Weekends:
   isWeekend(tS)
   tS[isWeekend(tS)]

timeDate

Rmetrics - Chronological and Calendar Objects

v3043.102
GPL (>= 2)
Authors
Diethelm Wuertz [aut], Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb], Joe W. Byers [ctb]
Initial release
2018-02-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.