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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 4 21:56:52 CEST 2012


Author: braverock
Date: 2012-05-04 21:56:52 +0200 (Fri, 04 May 2012)
New Revision: 1014

Modified:
   pkg/blotter/R/getPos.R
Log:
- force Date to be POSIXct if it isn't

Modified: pkg/blotter/R/getPos.R
===================================================================
--- pkg/blotter/R/getPos.R	2012-05-04 15:27:53 UTC (rev 1013)
+++ pkg/blotter/R/getPos.R	2012-05-04 19:56:52 UTC (rev 1014)
@@ -18,6 +18,7 @@
     # position average cost are returned.
     #if(nrow(PosData)>1) Pos = last(PosData[toDate][,Columns],n=n)
     if(nrow(PosData)>1) {
+        if(!inherits(Date,"POSIXct")) Date<-as.POSIXct(Date) 
         Pos = last(PosData[which(index(PosData)<=Date),][, Columns], n = n)
     } else Pos <- PosData[,Columns]
     return(Pos)



More information about the Blotter-commits mailing list