[R] Dates stuff ... beginner question
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Apr 15 17:21:36 CEST 2004
MMarques Power wrote:
>
> Putting it simly I have a date in format YYYYMMDD
> Year month day
> 20030301
> and I need simply the day of the week as an integer or even as
> string...
> according to the documentation in ISOdate or strptime functions
> I need to format it ...
>
> If I try something like :
>
> strptime("20030301","%u")
> [1] "2004-04-15"
>
> being %u the format value I need
> but as result I get the system actual date ??!?...
>
> Using Windows XP and the latest R1.9.0
> I need something like 1 for sunday and the sequent values for the rest
> of the week.
> What am I doing wrong...?
> Any help is welcomed...
You are looking for, e.g.:
format(strptime("20030301", "%Y%m%d"), "%A")
Note that the help says for format "%u":
" ... less widely implemented (e.g. not for output on Windows) ..."
Uwe Ligges
> Thanks in advance
> Marco Marques
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list