Skip to content
Prev 3554 / 15274 Next

Bug in PerformanceAnalytics 0.9.7.1

Hi,
 
I've hit a bug in PerformanceAnalytics 0.9.7.1: looks like the "sortDrawdowns()" function (usually invoked from "table.Drawdowns()") assumes that there's more than one drawdown, which is not necesarily the case. 
 
Code to reproduce the bug:
Error in if (runs$return[j] > runs$return[j + 1]) { : 
  missing value where TRUE/FALSE needed


Proposed solution: check the number of drawdowns in parameter 'runs' of function "sortDrawdowns()" before looping. Just add the following line at the beginning of 'sortDrawdowns':
Tested on the following environment:
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] PerformanceAnalytics_0.9.7.1 zoo_1.5-4                    rcom_2.0-4                   rscproxy_1.0-12             

loaded via a namespace (and not attached):
[1] grid_2.8.1      lattice_0.17-17 tools_2.8.1 


Best,

Enrique