title: R: upSample in Caret is removing target variable completely
body: <p>I am trying to upsample an imbalanced dataset in <code>R</code> using the <code>upSample</code> function in Caret. However upon applying the function it completely removes the target variable <code>C_flag</code> from the dataset. Here is my code:</p>
  <pre><code>set.seed(100)
  '%ni%' &lt;- Negate('%in%')
  up_train &lt;- upSample(x = train[, colnames(train) %ni% &quot;C_flag&quot;], #all predictor variables
                       y = train$C_flag) #target variable
  </code></pre>
  <p>Here is the amount of each category of <code>C_flag</code> in the train set.
  <code>0 = 100193</code>, <code>1=29651</code>.</p>
  <p>I test to see if <code>C_flag</code> is there with this result:</p>
  <pre><code>print(up_train$C_flag)
  NULL
  </code></pre>
  <p>Does anyone know why this function is removing this variable instead of upsampling?</p>