title: Multi-Dimensional Array vs. List of list tuples
body: <p>I'm writing some code to perform some game theory simulations.
  My "world" has several states (say 2 in my case), it also has several players (again, 2), and each player has a matrix of payouts (2 by 2).</p>
  
  <p>I tried creating the following multi-dimensional array in R:</p>
  
  <pre><code>U = array(2,2,2,2)
  U[1][1] = cbind(c(0.7,0.3),c(0.3,0.7))
  </code></pre>
  
  <p>and I receive the following error:</p>
  
  <pre><code>number of items to replace is not a multiple of replacement length
  </code></pre>
  
  <p>I can move to using a list, in which each item will be a list of two items, A and B, where A and B are 2x2 matrices. However, I think that performing operations on the lists will become slowly annoying and vectorization will be hard.</p>
  
  <p>Is there a suggestion on the proper implementation or an explanation on why the above code doesn't work?</p>
  
  <p>Update: Apparently the proper syntax would be:</p>
  
  <pre><code>U[1,1, , ] = cbind(c(0.7,0.3),c(0.3,0.7))
  </code></pre>
  
  <p>My question still stands - which is better, multi-dimensional vectors or list of tuples?</p>
  
  <p>Thanks,</p>
  
  <ul>
  <li>Ron</li>
  </ul>