[R] workweek calculation
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Nov 27 15:26:54 CET 2001
On Tue, 27 Nov 2001 lutz.thieme at amd.com wrote:
> Hello everybody,
> I'm looking for a library or function to calculate a workweek from
> a given date, but I didn't found it. Could anybody help, please?
> Thank you in advance!
x <- Sys.time()
y <- as.POSIXlt(x)
(y$yday - y$wday)%/%7
is at least one definition of the week of the year (starting on Sundays).
Modify to suit your needs.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help