Hi R helpers,
I want to write a function which will
1. Count the number of fridays in the current month ( to extract month from
given date) and also the number of fridays in the preceeding month
2. Calculate the ratio of the number of fridays in current month to the
number of fridays in the
On 10/10/2014, 7:28 AM, Abhinaba Roy wrote:
Hi R helpers,
I want to write a function which will
1. Count the number of fridays in the current month ( to extract month from
given date) and also the number of fridays in the preceeding month
2. Calculate the ratio of the number of fridays
Hi Duncan,
I have converted the string to a POSIXIt object using
strptime('31-may-2014',format=%d-%b-%Y)
But could not figure out the way forward.
Could you please elaborate a bit?
On Fri, Oct 10, 2014 at 5:14 PM, Duncan Murdoch murdoch.dun...@gmail.com
wrote:
On 10/10/2014, 7:28 AM,
On 10/10/2014 8:10 AM, Abhinaba Roy wrote:
Hi Duncan,
I have converted the string to a POSIXIt object using
strptime('31-may-2014',format=%d-%b-%Y)
But could not figure out the way forward.
Could you please elaborate a bit?
Try this:
?POSIXlt
Duncan Murdoch
On Fri, Oct 10, 2014 at
Or try this:
fridays - function(the_day){
require(lubridate)
day(the_day) = 1
the_month = seq(the_day, the_day+months(1)-days(1),1)
sum(wday(the_month) == 6)
}
That returns the number of Fridays in the month of a Date object given as arg:
fridays(as.Date(2012-01-01))
[1] 4
On Fri, Oct 10, 2014 at 7:28 AM, Abhinaba Roy abhinabaro...@gmail.com wrote:
Hi R helpers,
I want to write a function which will
1. Count the number of fridays in the current month ( to extract month from
given date) and also the number of fridays in the preceeding month
2. Calculate the
In my Impression, there seems exsits a function (let just call weekday) which
can return a POSIXlt format date 's weekday. That means, weekday( 31-may-2014
) may return the right weekday maybe 5, so a clumsy method is start to judge
from 1-may-2014 to 31-may-2014 , you get a vector x,
7 matches
Mail list logo