s-news
[Top] [All Lists]

inverting a timeDate sequence

To: "SPlus-News" <s-news@wubios.wustl.edu>
Subject: inverting a timeDate sequence
From: "Paul H. Lasky" <phlasky@earthlink.net>
Date: Tue, 16 Sep 2003 12:36:28 -0700
    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
      
 
<Prev in Thread] Current Thread [Next in Thread>