[R] How to create a time series from a data set where some days are skipped

arun smartpink111 at yahoo.com
Wed May 21 13:07:12 CEST 2014



Hi,

You may check ?isWeekday, ?isBizday, from library(timeDate)
library(timeDate)
tS <- timeSequence(as.Date("2008/1/1"), as.Date("2014/4/21"))
tWd <- tS[isWeekday(tS)]
length(tWd)
#[1] 1645

 pubHolUS <- holiday(2008:2014,listHolidays("US"))

tS1 <- tS[isBizday(tS, holidays = holidayNYSE(2008:2014), wday = 1:5)]
length(tS1)
#[1] 1588


 tS2 <- tS[isBizday(tS,holidays=holiday(2008:2014,listHolidays("US")), wday=1:5)]
 length(tS2)
#[1] 1552

A.K.



On Wednesday, May 21, 2014 3:08 AM, Charles Thuo <tcmuigai at gmail.com> wrote:
I have a data set with daily claim numbers. I group with monthly totals and
create a time series as follows


v.ts<- ts(v, start=2008,frequency=12)

How can the daily data be converted into a time series where there is no
claim number for sundays and public holidays.


Charles.

    [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list