[Blotter-commits] r141 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 12 17:48:54 CET 2010


Author: jryan
Date: 2010-01-12 17:48:54 +0100 (Tue, 12 Jan 2010)
New Revision: 141

Modified:
   pkg/blotter/R/updatePosPL.R
Log:
o  removed reliance on grep, replaced with [.xts which.i=TRUE


Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2010-01-12 16:35:01 UTC (rev 140)
+++ pkg/blotter/R/updatePosPL.R	2010-01-12 16:48:54 UTC (rev 141)
@@ -29,7 +29,8 @@
         # Get the current date and close price
         CurrentDate = Dates[i]
 #          if(i>1) # if it isn't the first price in the time series
-            PrevDate = time(Prices[grep(CurrentDate,time(Prices))-1])
+            #PrevDate = time(Prices[grep(CurrentDate,time(Prices))-1])
+            PrevDate = time(Prices[Prices[CurrentDate,which.i=TRUE]-1]) # which.i is new in [.xts
 #          else
           if(length(PrevDate)==0)
              PrevDate = NA



More information about the Blotter-commits mailing list