Message-ID: <546EBA2E-CE27-4AA3-A658-69B98DDC9152@comcast.net>
Date: 2009-01-15T19:50:42Z
From: David Winsemius
Subject: number of Mondays
In-Reply-To: <EBA7025A-028E-461E-80FB-3AB7EF129041@gmail.com>
On Jan 15, 2009, at 2:28 PM, Carlos Hernandez wrote:
> dear All,
> i'm trying to calculate the number of Mondays, Tuesdays, etc that
> each month within a date range has. I have time series data that
> spans 60 months and i want to calculate the number of Mondays,
> Tuesdays, Wed, etc of each month. (I want to control for weekly
> seasonality but my data is monthly).
>
> Is there an easy way to to this in R? or is there a package i could
> use? i did some quick search in the help files and R sites but could
> not find any answers.
The chron package has a wide assortment of functions of that sort.
Looks like Mondays would be 1
> day.of.week(1,15,2009) # a Thursday
[1] 4
> day.of.week(1,18,2009) #Saturday
[1] 0
> day.of.week(1,17,2009) #Sunday
[1] 6
--
David Winsemius