Re: [R] quantiles for dates

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Wed, 14 May 2008 16:14:32 +0000 (UTC)

GOUACHE David <D.GOUACHE <at> arvalisinstitutduvegetal.fr> writes:

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

Since dates are just decorated numbers, you can convert in both way. Written the long way:

dt = rpois(100,100)
class(dt)="Date"
dt
# [1] "1970-03-30" "1970-04-18" "1970-04-08" "1970-04-13"

# Dates are generated now
dq= quantile(as.integer(dt))
dq
# 0% 25% 50% 75% 100%
# 77.00 93.00 98.50 106.25 119.00
class(dq)="Date"
dq
# 0% 25% 50% 75% 100% #"1970-03-19" "1970-04-04" "1970-04-09" "1970-04-17" "1970-04-30"  

---
Dieter

______________________________________________
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.
Received on Wed 14 May 2008 - 19:37:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 May 2008 - 20:30:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive