splitFolds <- function(indexFeature, DT_folds, feat, folds){
## Define training set output
DT_training <- vector("list", length=7)
## Populate testing dataset based on 'folds'
DT_testing <- DT_folds[[feat]][[folds]]
## Populate tuning dataset based on 'folds'.
## Visually, this is the next set after the testing dataset
## 'toCombine' is an index to populate training dataset based on NOT 'folds'
if(folds < length(DT_folds[[feat]])){
DT_tuning <- DT_folds[[feat]][[folds+1]]
toCombine <- which(!(seq_along(DT_folds[[feat]]) %in% c(folds, folds+1)))
} else{
DT_tuning <- DT_folds[[feat]][[1]]
toCombine <- which(!(seq_along(DT_folds[[feat]]) %in% c(1, folds)))
}
## Push remaining folds into a single training dataset
for(combining in seq_along(toCombine)){
## First iteration, initialize 'DT_training' to first fold
if(combining == 1){
DT_training[[feat]] <- DT_folds[[feat]][[toCombine[combining]]]
} else{
## Strip non-feature-related columns in subsequent folds and column bind
minimumCol <- grep("ExactMass", colnames(DT_folds[[feat]][[toCombine[combining]]]))
temp <- DT_folds[[feat]][[toCombine[combining]]]
temp <- temp[, (minimumCol+1):ncol(temp)]
DT_training[[feat]] <- cbind(DT_training[[feat]], temp)
}
}
return(list(testing = DT_testing,
tuning = DT_tuning,
training = DT_training[[feat]]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.