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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 26 03:22:10 CEST 2012


Author: gsee
Date: 2012-08-26 03:22:09 +0200 (Sun, 26 Aug 2012)
New Revision: 1134

Modified:
   pkg/blotter/R/addTxn.R
Log:
fix if statement to avoid calling inherits on an object that does not exist

Modified: pkg/blotter/R/addTxn.R
===================================================================
--- pkg/blotter/R/addTxn.R	2012-08-25 23:16:52 UTC (rev 1133)
+++ pkg/blotter/R/addTxn.R	2012-08-26 01:22:09 UTC (rev 1134)
@@ -85,9 +85,11 @@
 
     # FUNCTION
     # Coerce the transaction fees to a function if a string was supplied
-    if (is.character(TxnFees)) TF <- try(match.fun(TxnFees))
-    if (!inherits(TF,"try-error")) TxnFees<-TF
-
+    
+    if (is.character(TxnFees)) {
+        TF <- try(match.fun(TxnFees))
+        if (!inherits(TF,"try-error")) TxnFees<-TF
+    }
     # Compute transaction fees if a function was supplied
     if (is.function(TxnFees)) txnfees <- TxnFees(TxnQty, TxnPrice) else txnfees<- as.numeric(TxnFees)
 



More information about the Blotter-commits mailing list