title: How to split data where the Input has size 841
body: <p>I am trying to split my data into test and train (data = all.traits), however, this error message shows up every time:</p>
  <pre><code>Error: Must subset rows with a valid subscript vector.
  ℹ Logical subscripts must match the size of the indexed input.
  x Input has size 841 but subscript `split_data == 0` has size 840.
  </code></pre>
  <p>I have 841 rows but the split always sees the data as a total of 840 so the data won't split</p>
  <p>I tried this code:</p>
  <pre><code>split1\&lt;- sample(c(rep(0, 0.7 \* nrow(all.traits)), rep(1, 0.3 \* nrow(all.traits))))
  split1
  table(split1)
  train \&lt;- all.traits\[split1 == 0, \]
  test \&lt;- all.traits\[split1== 1, \]
  </code></pre>
  <p>I also found on here that adding <code>round()</code> should help, but I get the same error message:</p>
  <pre><code> set.seed(1234)
      split_data_frame &lt;- sample(c(rep(0, round(0.7 * nrow(all.traits))), rep(1, round(0.3 * nrow(all.traits)))))
      
      table(split_data_frame)
      
      train &lt;- all.traits[split_data == 0, ]
      test &lt;- all.traits[split_data == 1, ]
  </code></pre>