Charles Thuo
2014-May-21 07:06 UTC
[R] How to create a time series from a data set where some days are skipped
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]]
arun
2014-May-21 11:07 UTC
[R] How to create a time series from a data set where some days are skipped
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.