[Rd] pretty.Date(): new "halfmonth" time step

Felix Andrews felix at nfrac.org
Thu May 20 04:48:26 CEST 2010


On 20 May 2010 11:56, Daniel Murphy <chiefmurphy at gmail.com> wrote:
>>Much better to implement directly what this is trying to do: i.e. to
>>have a "halfmonth" time step. This is just the union of two "monthly"
>>sequences, one on the 1st of each month and another on the 15th of
>>each month.
>
> For some applications that might be true. But not for others. For a month
> with 31 days, there are 14 days before the 15th of the month and 16 days
> after the 15th, so, for example, March 16th (specifically noon) rather than
> March 15th would be the halfway point if you define "halfway" in terms of
> the distances to the beginning and end of the month. For a month with 30
> days -- like April -- the halfway point would be the instant between the
> 15th and the 16th of the month. Do you label that instant April 15 or April
> 16?  (I prefer "15".) Don't get me started on February.

Dan, you are correct: the midpoint of a 30 day month is the 16th at
00:00. That instant is called the 16th according to print.POSIXt.

junstart <- as.POSIXct("2000-06-01 00:00", tz="GMT")
julstart <- as.POSIXct("2000-07-01 00:00", tz="GMT")
junstart + ((julstart - junstart) / 2)
#[1] "2000-06-16 GMT"

How embarassing...
So I think it would be better to use 16 rather than 15 for the
"halfmonth" time step.

Yes, months have variable lengths, but I think it is best to use a
consistent date (the 16th) than to calculate exact midpoints, just as
a normal monthly series has a consistent date (the 1st) and has
variable lengths.

Regards
-Felix


>
> - Dan Murphy
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/



More information about the R-devel mailing list