I am trying to make a k-fold cross validation in R without using the caret package, since the model I am using (clickstream in R) is not in the built-in library of the package.