Skip to content

Days of the week?

4 messages · John McHenry, Dirk Eddelbuettel, Gabor Grothendieck

#
On 24 January 2007 at 17:39, John McHenry wrote:
| What is the "standard" way to get the day of the week from a date such 
| as as.Date("2006-12-01")? It looks like fCalendar has some functions
| but this requires a change in the R locale to GMT. Is there another way?

Yes, go to POSIXlt and extract the wday field (see ?POSIXlt for more):
[1] 5
[1] 5 6 0 1 2 3 4
Dirk
#
You can use as.numeric(format(d, "%w")) .  See ?strptime and also
the help desk article in R News 4/1.
On 1/24/07, John McHenry <john_d_mchenry at yahoo.com> wrote: