I have a list of data.frames and would like to use the R package caret to create a new column in each data.frame, folds. So far I tried to write a custom function and then apply it to my list using map. Any suggestions would be appreciated.
library(caret)
one = airquality[1:10,]
two = airquality[11:20,]
listdf <- list(one, two)
foldfunc <- function(x) {
folds <- createFolds(1:nrow(x), k=10,list = F)
x$folds <- folds
}
map(listdf, foldfunc)