[Blotter-commits] r898 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Dec 30 18:16:07 CET 2011
Author: braverock
Date: 2011-12-30 18:16:06 +0100 (Fri, 30 Dec 2011)
New Revision: 898
Modified:
pkg/blotter/R/tradeStats.R
Log:
- remove apply statement around sd.
+ in case of tradeStats, PL.ne0 can be converted to a numeric vector before sd call
+ in case of dailyStats, PL.ne0 was alrady a numeric vector, so deprecated behavior does not occur
Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R 2011-12-30 15:56:26 UTC (rev 897)
+++ pkg/blotter/R/tradeStats.R 2011-12-30 17:16:06 UTC (rev 898)
@@ -89,7 +89,7 @@
AvgTradePL <- mean(PL.ne0)
MedTradePL <- median(PL.ne0)
- StdTradePL <- as.numeric(apply(PL.ne0, 2, sd))
+ StdTradePL <- sd(as.numeric(as.vector((PL.ne0)))
NumberOfTrades <- nrow(txn)-1
@@ -110,7 +110,7 @@
DailyPL <- apply.daily(PL.ne0,sum)
AvgDailyPL <- mean(DailyPL)
MedDailyPL <- median(DailyPL)
- StdDailyPL <- as.numeric(apply(DailyPL, 2, sd))
+ StdDailyPL <- sd(as.numeric(as.vector(DailyPL)))
Equity <- cumsum(posPL$Net.Trading.PL)
if(!nrow(Equity)){
@@ -298,7 +298,7 @@
AvgDayPL <- as.numeric(mean(PL.ne0))
MedDayPL <- as.numeric(median(PL.ne0))
- StdDayPL <- as.numeric(apply(PL.ne0, 2, sd))
+ StdDayPL <- as.numeric(sd(PL.ne0))
#NumberOfDays <- nrow(txn)
WinDays <-length(PL.gt0)
@@ -319,7 +319,7 @@
AvgDailyPL <- as.numeric(mean(PL.ne0))
MedDailyPL <- as.numeric(median(PL.ne0))
- StdDailyPL <- as.numeric(apply(PL.ne0, 2, sd))
+ StdDailyPL <- as.numeric(sd(PL.ne0))
Equity <- cumsum(x)
Equity.max <- cummax(Equity)
More information about the Blotter-commits
mailing list