Hi list, 

I'm trying to turn a date into something productive. (Not what you may be 
thinking....) 

I want three functions so I could take a "date" object and get the day of week, 
month, and year from it.

xx <- as.Date("2006-01-05") 

month(xx) equal 1
day(xx) equal 5
year(xx) equal 2006

I'm aware of the weekdays() and months() functions in the base package. But 
they return a character object which requires some coding to convert into a 
numeric value.

I've also tried the sday.of.week() in fCalendar but it doesn't like my date,

> sday.of.week(xx)
Error in Ops.Date(sdates, 10000) : %/% not defined for Date objects

Do these functions exist in some package I'm not aware of?

Thanks in adv.

Horace Tso

______________________________________________
[email protected] 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.

Reply via email to