title: Subsetting in Logistic Regression modeling in R
body: <p>I received the following error messages when splitting and subsetting my data in the process of logistic regression in R. I am stuck at the &quot;subset&quot; step.</p>
  <pre><code>    library(caTools)
      split &lt;-sample.split(df1, SplitRatio = 0.5)
      split
      training &lt;- subset(df1, split == &quot;TRUE&quot;)
      testing &lt;- subset(df1, split == &quot;FALSE&quot;)
  </code></pre>
  <p>The error:</p>
  <blockquote>
  <p>Error: Must subset rows with a valid subscript vector. i Logical
  subscripts must match the size of the indexed input. x Input has size
  333030 but subscript i has size 9. Run rlang::last_error() to see
  where the error occurred.</p>
  </blockquote>