If y has only two unique values, fold assignments are chosen so that the
balance between outcomes is the same in each fold. This is useful for
logistic regression and time-to-event data (to balance the fraction of
observations that are censored).
Usage
assign_fold(y, folds, seed)
Value
A vector of integers indicating fold assignments
Arguments
y
Either (i) the vector of outcomes or (ii) a vector such as 1:n