title: Does dummyVars predict really return a data frame?
body: <p>The <code>predict</code> method for <code>dummyVars</code> from the <code>caret</code> library has <a href="https://www.rdocumentation.org/packages/caret/versions/6.0-86/topics/dummyVars" rel="nofollow noreferrer">documentation</a> that clearly states:</p>
  
  <blockquote>
    <p>"<em>The predict function produces a data frame.</em>"</p>
  </blockquote>
  
  <p>However, every example that I've produced appear to only be a matrix. The following code is an example of this:</p>
  
  <pre><code>&gt;input&lt;-data.frame(id=c(1, 2, 3), direction=c('up', 'down', 'down'))
  &gt;dmy&lt;-dummyVars(" ~ .",input)
  &gt;output&lt;-predict(dmy, newdata=input)
  &gt;output
    id direction.down direction.up
  1  1              0            1
  2  2              1            0
  3  3              1            0
  &gt;class(output)
  [1] "matrix"
  &gt;is.data.frame(output)
  [1] FALSE
  &gt;is.matrix(output)
  [1] TRUE
  </code></pre>
  
  <p>Everything that I can see indicates that the documentation is wrong and that the <code>predict</code> function is really returning a matrix rather than a data frame. What's going on?</p>