Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dates<-seq(as.Date("1991/1/4"),as.Date("2010/3/1"),"days")
- # install.packages('timeDate')
- require(timeDate)
- # A ’timeDate’ Sequence
- tS <- timeSequence(as.Date("1991/1/4"), as.Date("2010/3/1"))
- tS
- # Subset weekdays
- tW <- tS[isWeekday(tS)]; tW
- dayOfWeek(tW)
- X <- seq( as.Date("1991/1/4", format="%Y/%m/%d"), as.Date("2010/3/1", format="%Y/%m/%d"),"days")
- weekdays.X <- X[ ! weekdays(X) %in% c("Saturday", "Sunday") ]
- # negation easier since only two cases in exclusion
- # probably do not want to print that vector to screen.
- str(weekdays.X)
- > table(weekdays(weekdays.X) )
- Friday Monday Thursday Tuesday Wednesday
- 1000 1000 999 999 999
Add Comment
Please, Sign In to add comment