I have a data.table in R which I want to use with caret package
set.seed(42)
trainingRows<-createDataPartition(DT$variable, p=0.75, list=FALSE)
head(train
The reason is that createDataPartition
produces integer vector with two dimensions where the second could be losslessly dropped.
You can simply reduce dimension of trainingRows
using below:
DT[trainingRows[,1]]
The c()
function from Bruce Pucci's answer will reduce dimension too.
This minor difference vs. data.frame was spotted long time ago and recently I've made PR #1275 to fill that gap.