[R] quantiles for dates

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed May 14 17:40:11 CEST 2008


On Wed, 14 May 2008, GOUACHE David wrote:

> Hello all,
>
> I was wondering if there is a package in which someone would have 
> created a quantile function that handles vectors of class "Date".

What is the median of today and tomorrow, expressed as a day?

Quantiles of discrete distributions are not unambiguously defined. If you 
have an answer to that, quantile(type=1) may help you, e.g.

> as.Date(quantile(as.vector(x), type=1), origin="1970-01-01")
           0%          25%          50%          75%         100%
"1972-07-01" "1977-01-01" "1983-07-01" "1993-07-01" "2006-01-01"


> In advance thanks.
>
> David Gouache
> ARVALIS - Institut du végétal
> Station de La Minière
> 78280 Guyancourt
> Tel: 01.30.12.96.22 / Port: 06.86.08.94.32

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list