timeSeq(from="9/15/2003", to = "4/15/2003", by="bizdays", k.by=-1)
Nick Ellis
CSIRO Marine Research mailto:Nick.Ellis@csiro.au
PO Box 120 ph +61 (07) 3826 7260
Cleveland QLD 4163 fax +61 (07) 3826 7222
Australia http://www.marine.csiro.au
-----Original Message-----
From: Paul H. Lasky [mailto:phlasky@earthlink.net]
Sent: Wednesday, 17 September 2003 5:36 AM
To: SPlus-News
Subject: [S] inverting a timeDate sequence
How do you create a timeDate sequence with the latest date as the first
element and oldest date the last element, AND exclude weekends (utilizing Splus
6.1)? The following efforts were unsuccessful:
td = timeSeq(from="9/15/2003", to = "4/15/2003", by=-"bizdays")
td = timeSeq(from="9/15/2003", to="4/15/2003", by = "bizdays")
or
td1 = timeSeq(from="4/15/2003", to"9/15/2003", by="bizdays")
td = -sort(-td1) [ sort does not work with timeDate sequences]
Is it really necessary to inelegantly process td1 in a for loop --- which
does work ? e.g.
td = td1
for( i in 1:length(td1) ) td[ length(td1) -i +1 ] = td1[ i ] }
Incidentally this is a very slow processing.
Paul H. Lasky
B & P Consultants
Rancho Santa Fe, CA
|