timeDate objects are stored internally as a list of integers. You can
reverse them by:
> td@.Data[[1]] = rev(td@.Data[[1]])
> td@.Data[[2]] = rev(td@.Data[[2]])
----
Jeffrey Wang
Ronin Capital LLC
Chicago, IL 60604
Tel: (312) 244-5768
Fax: (312) 244-5836
-----Original Message-----
From: Paul H. Lasky [mailto:phlasky@earthlink.net]
Sent: Tuesday, September 16, 2003 2:36 PM
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
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news