Learn R Programming

timeDate (version 290.84)

isWeekday: Weekdays and Weekends

Description

Tests if a date is a weekday or not.

Usage

isWeekday(x)
isWeekend(x)

Arguments

x
an object of class timeDate.

Value

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

Examples

Run this code
## 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)]

Run the code above in your browser using DataLab