title: Error when adding a new column: requires numeric/complex matrix/vector arguments
body: <p>My data set contains 6 companies monthly returns which look like below (but has many more rows):</p>
  
  <pre><code>RMA RMB RMC     RMD     RME      RMF
  NA  NA  NA      0.0099  -0.0009  NA
  NA  NA  0.0395  -0.0030 0.0024   NA 
  </code></pre>
  
  <p>These companies made up the portfolio. As a result, each one has its weight.</p>
  
  <pre><code>WRMA    &lt;-  0.36
  WRMB    &lt;-  0.12
  WRMC    &lt;-  0.11
  WRMD    &lt;-  0.24
  WRME    &lt;-  0.15
  WRMF    &lt;-  0.02
  </code></pre>
  
  <p>What I'm trying to do is to create a column called GWMR, which =RMA x WRMA + RMB x WRMB + ... + RMF x WRMF.</p>
  
  <p>Here's what I did:</p>
  
  <pre><code>weights &lt;- c(WRMA,WRMB,WRMC,WRMD,WRME,WRMF)
  GAA2 &lt;- GAA
  GAA2[is.na(GAA2] &lt;- 0
  GAA &lt;- cbind(GAA, GWMR = c(GAA2 %*% weights))
  </code></pre>
  
  <p>Then I got the error message: <code>Error in GAA2 %*% weights : 
    requires numeric/complex matrix/vector arguments</code></p>
  
  <p>I also tried : <code>GAA &lt;- cbind(GAA, GWMR = c(GAA2 %*% as.matrix(weights)))</code>. Still got the same error message. How may I get this right? Thanks!</p>