R programs for k-fold cross-validation