[Blotter-commits] r1705 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Oct 30 14:13:25 CET 2015
Author: bodanker
Date: 2015-10-30 14:13:24 +0100 (Fri, 30 Oct 2015)
New Revision: 1705
Modified:
pkg/blotter/R/updatePosPL.R
Log:
Avoid warning when indexClass length > 1
The change in r1704 would cause the following warning when the prices
indexClass was POSIXct, because POSIXct extends the POSIXt virtual
class:
Warning messages:
1: In if (indexClass(prices) %in% c("Date", "yearmon", "yearqtr")) { :
the condition has length > 1 and only the first element will be used
Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R 2015-10-29 15:52:22 UTC (rev 1704)
+++ pkg/blotter/R/updatePosPL.R 2015-10-30 13:13:24 UTC (rev 1705)
@@ -39,7 +39,7 @@
if(is.null(Dates)) {
Dates = index(prices)
# Covert to POSIXct w/same TZ as portfolio object
- if(indexClass(prices) %in% c("Date","yearmon","yearqtr")) {
+ if(any(indexClass(prices) %in% c("Date","yearmon","yearqtr"))) {
portfTZ <- indexTZ(Portfolio$symbols[[Symbol]]$txn)
Dates <- as.POSIXct(as.character(as.Date(Dates)), tz=portfTZ)
}
More information about the Blotter-commits
mailing list