title: R's caTools Sample.Split Results Incorrect
body: <p>I'd like to preface my question by stating that this appears to be a common issue:</p>
  <ol>
  <li><a href="https://stackoverflow.com/questions/47547337/incorrect-splitting-of-data-using-sample-split-in-r-and-issue-with-logistic-regr">Incorrect splitting of data using sample.split in R and issue with logistic regression</a></li>
  <li><a href="https://stackoverflow.com/questions/57137152/splitratio-results-with-sample-split-catools">SplitRatio results with sample.split (caTools)</a></li>
  </ol>
  <p>Yet, I cannot fix my problem using the solutions recommended in the first question, and the second was never answered.</p>
  <p>In the following code, I would expect 100 observations for each of the four results, as obviously 100/150 = 2/3:</p>
  <pre><code>library(caTools)
  set.seed(123)
  
  isample &lt;- sample.split(iris[,1], SplitRatio = 2/3, group = NULL)
  iris2 &lt;- iris[isample,]
  
  isample2 &lt;- sample.split(iris[,1], SplitRatio = 2/3, group = NULL)
  iris3 &lt;- subset(iris, isample2 == T)
  
  isample3 &lt;- sample.split(iris$Sepal.Length, SplitRatio = 2/3, group = NULL)
  sepal.length2 &lt;- iris[isample3,1]
  
  isample4 &lt;- sample.split(iris$Sepal.Length, SplitRatio = 2/3, group = NULL)
  sepal.length3 &lt;- subset(iris[,1], isample4 == T)
  
  </code></pre>
  <p>However, I get 104 observations in both <code>iris2</code> and <code>iris3</code>, as well as the vectors <code>sepal.length2</code> and <code>sepal.length3</code>. I make sure to draw a new sample each time to ensure this isn't something weird with rounding in the sample function. Using column 2 and 3 from <code>iris</code> return 100 observations, but using column 5 returns 99 observations. Why does changing the column return different values? A common error with this function is to accidentally give it the entire data frame, so it selects based on the columns, but here I am making sure to give it a vector each time. In the last two examples, I am giving it a vector and then determining the split from a vector, and it still does not work.</p>
  <p>If it helps, I'm running R 3.6.0 and caTools 1.18.0 on OS X. I normally would use the <code>sample</code> or <code>sample.int</code> function, so I am not all that familiar with caTools.</p>