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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 13 18:39:36 CEST 2013


Author: peter_carl
Date: 2013-08-13 18:39:36 +0200 (Tue, 13 Aug 2013)
New Revision: 1490

Modified:
   pkg/blotter/R/updateAcct.R
Log:
- removed accidental row duplication
- removed row deduplication code


Modified: pkg/blotter/R/updateAcct.R
===================================================================
--- pkg/blotter/R/updateAcct.R	2013-08-13 14:51:33 UTC (rev 1489)
+++ pkg/blotter/R/updateAcct.R	2013-08-13 16:39:36 UTC (rev 1490)
@@ -133,30 +133,11 @@
         if(is.null(summary)) {summary=result}
         else {summary=cbind(summary,result)}
     }
+    browser()
     summary[is.na(summary)] <- 0 # replace any NA's with zero
     Account$summary <- rbind(Account$summary, summary)
     # This function does not calculate End.Eq 
 
-	Account$summary <- rbind(Account$summary, summary)
-
-	# get rid of duplicated indices in the summary data, 
-	# thanks to Guy Yollin for the bug report and Josh Ulrich for the elegant approach to fixing it
-	d <- duplicated(.index(Account$summary)) | duplicated(.index(Account$summary), fromLast=TRUE)
-	if(any(d)){
-		dedups <- function(x) {
-			suppressWarnings(
-					xts(t(colSums(x)),order.by=last(index(x)))
-			)
-		}
-		
-		alist <- do.call(rbind, lapply(split(Account$summary[d,], .index(Account$summary[d,])), dedups) )
-		
-		Account$summary <- rbind(Account$summary[!d,], alist) #put it all back together
-		
-	}
-	
-	# This function does not calculate End.Eq 
-
     assign(paste("account",name,sep='.'),Account, envir=.blotter) 
     return(name) #not sure this is a good idea
 }



More information about the Blotter-commits mailing list