title: Multiply elements of a matrix with vector values
body: <p>I have a matrix M, I want to create 3 additional matrices where each additional matrix has certain 3x3 column-slices of M multiplied by values in a vector, I will then store the resulting 3 new matrices in a <code>list</code>.</p>
  
  <pre><code>##create the initial matrix
  M &lt;- matrix(1:20, nrow = 4)
  
      [,1] [,2] [,3] [,4] [,5]
  [1,]    1    5    9   13   17
  [2,]    2    6   10   14   18
  [3,]    3    7   11   15   19
  [4,]    4    8   12   16   20
  
  ## coordinates in the matrix I want to alter 
  iy &lt;- c(1, 2, 3)
  ix &lt;- c(1, 4, 5)
  coords &lt;- as.data.frame(cbind(ix, iy))
  
  
  ## multiplier values
  multis &lt;- c(0.1, 2, 100)
  </code></pre>
  
  <p>Pseudo code of what I want to do</p>
  
  <pre><code>mapply (function(multis, cords) {multis * M[coords$iy, coords$ix]})
  </code></pre>
  
  <p>what the result should look like</p>
  
  <pre><code>  [[1]]
       [,1] [,2] [,3] [,4] [,5]
  [1,]  0.1    5    9 13.0 17.0
  [2,]  2.0    6   10  1.4 18.0
  [3,]  3.0    7   11 15.0  1.1
  [4,]  4.0    8   12 16.0 20.0
  
  [[2]]
       [,1] [,2] [,3] [,4] [,5]
  [1,]    2    5    9   13   17
  [2,]    2    6   10   28   18
  [3,]    3    7   11   15   38
  [4,]    4    8   12   16   20
  
  [[3]]
  [,1] [,2] [,3] [,4] [,5]
  [1,]  100    5    9   13   17
  [2,]    2    6   10 1400   18
  [3,]    3    7   11   15 1900
  [4,]    4    8   12   16   20
  </code></pre>