[R] difficulty in Formatting time series data

Rui Barradas ruipbarradas at sapo.pt
Sun Apr 22 20:42:02 CEST 2012


Hello,

SMALL, reproducible examples...

Anyway, it's not that difficult. Try this

d.of.w <- as.integer(format(as.Date(test1$Date, format="%d/%m/%Y"), "%w"))
str(d.of.w)
head(d.of.w)


Note that the format '%w' gives days in 0-6, where Sunday == 0. See
?strftime.
Your Friday is therefore 5.
(Or use d.of.w <- d.of.w + 1)

Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/difficulty-in-Formatting-time-series-data-tp4578461p4578655.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list