title: dplyr mutate fails with named vector?
body: <p>I'm surprised to see that <code>dplyr's</code> <code>mutate</code> function is failing when I feed it a named vector. In this case it's the residuals from a model. Is this expected behavior? Oddly it seems to work fine if the named vector is not coming directly from a data.frame. Also works fine if I remove names.</p>
  
  <pre><code>toy &lt;- data.frame(x = rnorm(100), y=rnorm(100))
  mod &lt;- lm(y~x, data = toy)
  
  # Error: invalid subscript type 'list'
  toy &lt;- mutate(toy, fit = mod$fit, res = mod$res)
  
  # Fine
  fit &lt;- mod$fit
  res &lt;- mod$res
  toy &lt;- mutate(toy, fit = fit, res = res)
  
  # Fine
  toy &lt;- mutate(toy, fit = unname(mod$fit), res = unname(mod$res))
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I followed up on some of the suggestions and they do not seem to work. <code>plyr</code> is not loaded (I also tried dplyr::mutate to make double sure). I am using 0.4.2. Here's a screenshot with the session info.</p>
  
  <p><a href="https://i.stack.imgur.com/u8Wa1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u8Wa1.jpg" alt="enter image description here"></a></p>