[R-SIG-Finance] Question in blotter::updatePosPL file: argument is of length zero

Lei Jin leijin56 at gmail.com
Sat Dec 18 17:42:52 CET 2010


In the file updatePosPL.R, line 35 is

if(ncol(Prices)>1) Prices=getPrice(Prices,Symbol)

However, if the Prices() is NULL (which is by the default parameter to
this function), then ncol(Prices) is also NULL, and
this will cause the error below.

Should line 35 checks the prices, not Prices?

==================================================
debug: if (ncol(Prices) > 1) Prices = getPrice(Prices, Symbol)
Browse[2]> print(Prices)
NULL
Browse[2]> print(ncol(Prices))
NULL
Browse[2]> n
Error in if (ncol(Prices) > 1) Prices = getPrice(Prices, Symbol) :
 argument is of length zero
>

-- 
Lei



More information about the R-SIG-Finance mailing list