View source: R/computingutil.R
foldgen | R Documentation |
Stratified cross-validation fold generator function, inspired from the caret
foldgen(data, nfold = 5, stratVar = NULL)
data |
data frame used in the analysis |
nfold |
number of k-fold cross validations. Default is 5 |
stratVar |
Stratification Variable. Default is NULL and ID is used for CV |
return data.frame with the fold column attached
Vishal Sarsani, caret
d <- nlmixr2data::theo_sd
d$SEX <-0
d$SEX[d$ID<=6] <-1
covarsVec <- c("WT")
# Stratified cross-validation data with CMT
df1 <- foldgen(d, nfold=5, stratVar="CMT")
# Stratified cross-validation data with ID (individual)
df2 <- foldgen(d, nfold=5, stratVar=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.