[R] getting ISO week
Hans W. Borchers
hwborchers at gmail.com
Thu Dec 11 20:31:33 CET 2008
Gabor Grothendieck <ggrothendieck <at> gmail.com> writes:
>
> format(d, "%U") and format(d, "%W") give week numbers using
> different conventions. See ?strptime
Gabor,
the results of format(aDate, "W") appear to be incorrect anyway, see:
format(as.Date("2008-01-01"), "%W") #-> "00"
There is never a week 0, this should be week 1.
format(Sys.Date(), "%W") #-> "49"
but my business calendar says today's (Dec. 11, 2008) week is week 50
which is what Brian Ripleys proposed 'strftime(x, "%V")' returns.
There could be a format "%E" (not used up to now) for returning a
correct week number according to the European standard.
Yours, Hans Werner
> On Thu, Dec 11, 2008 at 7:43 AM, Gustaf Rydevik
> <gustaf.rydevik <at> gmail.com> wrote:
> > Hi all,
> >
> > Is there a simple function already implemented for getting the ISO
> > weeks of a Date object?
> > I couldn't find one, and so wrote my own function to do it, but would
> > appreciate a pointer to the "default" way. If a function is not yet
> > implemented, could the code below be of interest to submit to CRAN?
> >
> > Best Regards,
> >
> > Gustaf
> >
> > --------------------
>
> ... [rest deleted]
> ______________________________________________
> R-help <at> r-project.org 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.
>
>
More information about the R-help
mailing list