[R] Find out the day of week for a chron object?

Ajay Shah ajayshah at mayin.org
Mon Mar 1 17:48:33 CET 2004


I know that this is correct:

    library(chron)
    x = dates("01-03-04", format="d-m-y", out.format="day mon year")
    print(x)

It gives me the string "01 Mar 2004" which is correct.


I also know that I can say:

    print(day.of.week(3,1,2004))

in which case he says 1, for today is monday.


My question is: How do I combine these two!? :-) I have a data file
which is being parsed nicely and read in using the chron() function. I
need to identify fridays and treat them differently. So I need to run
the day.of.week function. But day.of.week() doesn't eat a chron
object, he insists he wants m,d,y. This seems quite odd. Any idea what
I can do?

Thanks,

        -ans.

-- 
Ajay Shah                                                   Consultant
ajayshah at mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi




More information about the R-help mailing list