I'm running a section of code which I have ran successfully multiple times before and I'm now getting an odd error which I don't understand:
### Data Splitting
trainIndex <- createDataPartition(dataset$isTerminated, p = .8,
list = FALSE,
times = 1)
head(trainIndex)
# Step 2: Create the training and testing datasets
testData <- dataset[-trainIndex, ]
trainingData <- dataset[trainIndex, ]
testData <- dataset[-trainIndex, ] works fine, but when I run
trainingData <- dataset[trainIndex, ] gives me an error of Error:imust have one dimension, not 2.
I've checked the code against https://topepo.github.io/caret/data-splitting.html and it matches. Has anyone else come across it and found a solution?