[R] difficulty in Formatting time series data

Berend Hasselman bhh at xs4all.nl
Sun Apr 22 20:29:47 CEST 2012


On 22-04-2012, at 20:12, Raghuraman Ramachandran wrote:

> I tried downloading using as.is and have also provided the dput below. The
> date for example is 20/4/2012 and wday gives 2 instead of 6? Thanks for all
> your help.

dt <- "20/04/2012"

> as.Date(dt)
[1] "0020-04-20"
> as.Date(dt,format="%d/%m/%Y")
[1] "2012-04-20"

> weekdays(as.Date(dt,format="%d/%m/%Y"))
[1] "Friday"


Read the help for as.Date

Berend



More information about the R-help mailing list