title: Matrix Multiplication Function with For Loop
body: <p>I am having a terrible time trying to do this seemingly easy function. I can't figure out why this won't work.</p>
  
  <p>My code:</p>
  
  <pre><code>C = matrix(0 , dim(matrixA)[1] , dim(matrixB)[2] , TRUE ) 
  mat_mult = function(matrixA, matrixB){
  for ( ii in 1:dim(matrixA)[1] ) {
     for ( jj in 1:dim(matrixB)[2] ) {
        for (kk in 1:dim(matrixA)[2] ) {
           C[ii,jj] = C[ii,jj] + matrixA[ii,kk]*matrixB[kk,jj]
        }
     }
   }
  
  
  }
  </code></pre>
  
  <p>I'm just trying to multiply two matrices together. Any ideas?</p>