The SplitRatio
argument does not behave like I would expect it to.
For example, if the SplitRatio
is 0.5
, I would expect 50% TRUE
and 50% FALSE
assignments.
However, when running the code below on a vector of length 20 I would expect 10 TRUE assignment but I frequently get results like 13 or 14.
Why is that?
vec <- sample(1:10, 20, replace = TRUE)
length(vec)
split <- sample.split(vec, SplitRatio = 0.5)
vec.split <- subset(vec, split == TRUE)
length(vec.split)
[1] 13