title: Getting "NAs are not allowed in subscripted assignments" while using Simplex in R
body: <p>I am running the following command:</p>
  
  <pre><code>&gt;simplex(a = a, A2 = A2, b2 = b2, A3 = A3, b3 = b3)
  </code></pre>
  
  <p>on which I get the error:</p>
  
  <pre><code>Error in pivot(tableau, prow, pcol) : 
    NAs are not allowed in subscripted assignments
  </code></pre>
  
  <p>Here is my R script:</p>
  
  <pre><code>library("boot")     # For simplex
  
  set.seed(100)
  
  i &lt;- 6
  X &lt;- rnorm(i, mean = 4, sd = 1)
  e &lt;- rnorm(i, mean = 0, sd = 1)
  Y &lt;- 5*X + e
  
  sum &lt;- 0
  Y_a &lt;- matrix(0,1,floor(i/2))                 
  for(miss in 1:floor(i/2)){
      sum &lt;- sum + Y[miss*2]
      Y_a[miss] &lt;- Y[miss*2]
  }
  
  Y_p &lt;- 5*rnorm(floor(i/2), mean = 4, sd = 1) + rnorm(floor(i/2), mean = 0, sd = 1)          
  a &lt;- matrix(0,1,2*floor(i/2))
  for(miss in 1:floor(i/2)){
      a[miss] &lt;- 1
  }
  A3 &lt;- t(apply(a,1, rev))
  A2 &lt;- matrix(0,2*floor(i/2),2*floor(i/2))
  
  for(miss in 1:floor(i/2)){
      index &lt;- 2*miss
      index_ &lt;- index - 1
      A2[index_,miss] &lt;- 1
      A2[index_,miss+floor(i/2)] &lt;- 1
      A2[index,miss] &lt;- 1
      A2[index,miss+floor(i/2)] &lt;- -1
  }
  b2 &lt;- matrix(0,2*floor(i/2),1)
  b2[(1:(2*floor(i/2)))%%2==1] &lt;- Y_p
  b2[(1:(2*floor(i/2)))%%2==0] &lt;- -Y_p
  simplex(a = a, A2 = A2, b2 = b2, A3 = A3, b3 = sum)
  </code></pre>
  
  <p>I get the above error when variable "i" is larger than 5, otherwise I get the error:</p>
  
  <pre><code>Error in simplex1(c(a, rep(0, m1 + 2 * m2 + m3)), cbind(rbind(A1, A2,  : 
    number of items to replace is not a multiple of replacement length
  In addition: Warning message:
  In simplex1(c(a, rep(0, m1 + 2 * m2 + m3)), cbind(rbind(A1, A2,  :
    number of items to replace is not a multiple of replacement length
  </code></pre>
  
  <p>I can't understand if these errors mean that the LP problem can't be solved or mean that there is a mistake in the way the function is called.</p>
  
  <p>Thanks in advance.</p>