title: limitations in the function backtest from the package fPortfolio
body: <blockquote>
    <p>Error message " Error: subscript out of bounds”</p>
  </blockquote>
  
  <p>In the function <strong>backtest</strong> from the package <strong>fPortfolio</strong></p>
  
  <p>Unfortunately, you can only read up to 73 columns here. otherwise</p>
  
  <blockquote>
    <p>"Error: Index out of bounds"</p>
  </blockquote>
  
  <p>I have read several records (the number of columns), it gets critical with 74 columns (assets) and more.</p>
  
  <p>If this can be avoided, there may be a deliberate restriction on the user?</p>
  
  <p>you can bypass the restrictions? is it possible to process more assets (data)?</p>
  
  <p>If I take only 73 assets, I get the right output, but not if 74 assets and more (than you became "Error: subscript out of bounds":</p>
  
  <pre><code>library(cluster)
  library(fMultivar)
  library(fPortfolio)
  library(mvoutlier)
  library(pastecs)
  library(timeSeries)
  library(tseries)
  
  SUP_USD.RET&lt;- readSeries(file.choose(), format = "%Y-%m-%d", sep = ",")
  manager.RET&lt;-as.timeSeries(SUP_USD.RET)
  managerData &lt;- 100 * manager.RET
  managerSpec &lt;- portfolioSpec()
  scenarios &lt;- dim(manager.RET)[1]
  assetsmitBenchmark &lt;- dim(manager.RET)[2]
  assetsmitBenchmark
  assets &lt;- (dim(manager.RET)[2]-1)
  scenarios
  assets
  managerConstraints &lt;- c('minW[1:assets]=0', 'maxW[1:assets]=0.10')
  managerBacktest &lt;- portfolioBacktest()
  setWindowsHorizon(managerBacktest) &lt;- "12m"
  setSmootherLambda(managerBacktest) &lt;- "3m"
  colnames(manager.RET)
  dim(manager.RET)
  
  colnames(manager.RET[,1])
  colnames(manager.RET[,2:73])
  #473 Assets gesamt
  bench1&lt;-colnames(manager.RET[,1])
  bench2&lt;-colnames(manager.RET[,2:73])
  #473 Assets gesamt
  
  as.formula(paste("SUP500_TR~ ",paste(bench2, collapse= "+")))
  managerFormula&lt;-(as.formula(paste("SUP500_TR~",paste(bench2, collapse= "+"))))
  
  managerPortfolios &lt;- portfolioBacktesting(formula = managerFormula,
  data = managerData, spec = managerSpec, constraints = managerConstraints,
  backtest = managerBacktest, trace = FALSE)
  </code></pre>
  
  <p>If I take only 73 assets, I get the right output:</p>
  
  <pre><code>Portfolio Backtesting:
  Assets:              AA01 AA02 AA03 AA04 AA05 AA06 AA07 AA08 AA09 AA10 AA11 AA12 AA13 AA14 AA15 AA16 AA17 AA18 AA19 AA20 AA21 AA22 AA23 AA24 AA25 AA26 AA27 AA28 AA29 AA30 AA31 AA32 AA33 AA34 AA35 AA36 AA37 AA38 AA39 AA40 AA41 AA42 AA43 AA44 AA45 AA46 AA47 AA48 AA49 AA50 AA51 AA52 AA53 AA54 AA55 AA56 AA57 AA58 AA59 AA60 AA61 AA62 AA63 AA64 AA65 AA66 AA67 AA68 AA69 AA70
  Benchmark:           SUP500_TR
  Start Series:        2010-12-28
  End Series:          2017-09-14
    Type:              MV
    Cov Estimator:     covEstimator
    Solver:            solveRquadprog
  Portfolio Windows:   equidistWindows
    Horizon:           12m
  Portfolio Strategy:  tangencyStrategy
  Portfolio Smoother:  emaSmoother
    doubleSmoothing:   TRUE
    Lambda:            3m
  Portfolio Optimization:
  Optimization Period     Target  Benchmark        Weights
  2010-12-01 2011-11-30    0.138   0.014           0       0.1     0       0       0       0       0       0       0.088   0       0       0       0       0       0       0       0       0.1     0       0.026   0.1     0.1     0       0       0.1     0       0.07    0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0       0       0.016   0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  2011-01-01 2011-12-31    0.127   0.014           0       0.1     0       0       0       0       0       0       0.03    0       0       0       0       0       0       0       0       0.1     0       0       0.1     0.1     0       0       0.1     0       0       0       0.1     0       0       0       0.1     0       0       0.007   0       0       0       0       0       0       0       0       0       0       0.062   0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  2011-02-01 2012-01-31    0.145   0.023           0       0.1     0       0       0       0       0.058   0       0       0       0       0       0       0       0       0       0       0.1     0       0       0.1     0.042   0       0       0.1     0       0       0       0       0       0       0       0.1     0       0       0.1     0       0       0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  2011-03-01 2012-02-29    0.152   0.038           0       0.1     0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0.1     0       0       0.1     0       0       0       0.1     0       0       0       0       0       0       0       0.1     0       0       0.1     0       0       0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  2011-04-01 2012-03-31    0.172   0.042           0       0.1     0       0       0       0       0.1     0       0       0       0       0       0       0       0.044   0       0       0.1     0       0       0.1     0       0       0       0.1     0       0       0       0       0       0       0       0.056   0       0       0.1     0       0       0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  2011-05-01 2012-04-30    0.153   0.031           0       0.1     0       0       0       0       0.1     0       0       0       0       0       0       0       0.046   0       0       0.1     0       0       0.015   0.057   0       0       0.1     0       0       0       0       0       0       0       0.01    0       0       0.1     0       0       0       0       0       0       0       0       0       0       0.1     0       0       0       0.1     0       0       0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.071   0       0        *  1
  2011-06-01 2012-05-31    0.14    0.008           0       0.1     0       0       0       0       0       0       0       0       0       0       0       0       0.064   0       0       0.1     0       0       0.058   0       0       0       0.1     0       0       0       0       0       0       0       0.079   0       0       0       0       0       0       0       0       0       0       0       0       0       0.1     0       0       0       0.1     0       0.1     0       0       0.1     0       0       0       0       0       0       0       0       0       0       0       0.1     0       0        *  1
  </code></pre>