title: Error "x and xtest must have the same number of columns" when using randomForest
body: <p>I am getting an error when I am trying to use randomForest in R. 
  When I enter</p>
  
  <pre><code>basic3prox  &lt;- randomForest(activity ~.,data=train,proximity=TRUE,xtest=valid)
  </code></pre>
  
  <p>where train is a dataframe of training data and valid is a dataframe of test data,
  I get the following error</p>
  
  <pre><code>Error in randomForest.default(m, y, ...) : 
    x and xtest must have same number of columns
  </code></pre>
  
  <p>But they do have the same number of columns. I used subset() to get them from the same original dataset and when I run dim() i get</p>
  
  <blockquote>
    <p>dim(train)</p>
  </blockquote>
  
  <p>[1] 3237  563</p>
  
  <blockquote>
    <p>dim(valid)</p>
  </blockquote>
  
  <p>[1] 2630  563</p>
  
  <p>So I am at a loss to figure out what is wrong here. </p>