Hello,
You should say from what package are the functions you're using.
From the help page of createFolds, the return value is "A list or
matrix of row position integers corresponding to the training data"
So to subset use `[` or `[[`. Try
class(folds$index$Fold_i)
If it's a numeric vector, folds$index$Fold_i[i]
If it's a matrix, folds$index$Fold_i[i, j]
If it's a list, folds$index$Fold_i[[i]]
Hope this helps,
Rui Barradas
Em 07-04-2013 13:24, Nicolás Sánchez escreveu:
Hello!
I have a question. I am working with createFolds:
folds<- trainControl(method='cv', index=createFolds(data$Score,list = TRUE))
I need to iterate over folds to extract the indexes from each fold.
For example, if I do folds$index$Fold01, it contains:
5 11 17 29 44 50 52 64 65
I need to iterate over each $Fold_i to extract the indexes, but I can't do
it because I don't know how to iterate over the structure folds$index$Fold_i
Any ideas?
Thanks!
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.