When y is numeric, but has no variation, breaks will be the single value of y. However, cut will interpret this single value not as the value where a cut should be made, but as the number of breaks to make. When the y value is an integer, this will likely lead to an unexpected result where the number of breaks made is the y value, rather than the value of cuts. When the y value is not an integer, this will return an error because breaks can only be an integer.
update.packages(oldPkgs="caret", ask=FALSE)
sessionInfo()
Minimal, reproducible example:
It appears this issue is because of this section of
createFolds
When
y
is numeric, but has no variation,breaks
will be the single value of y. However,cut
will interpret this single value not as the value where a cut should be made, but as the number of breaks to make. When the y value is an integer, this will likely lead to an unexpected result where the number of breaks made is the y value, rather than the value of cuts. When the y value is not an integer, this will return an error because breaks can only be an integer.Session Info: