I'm getting the following error when I try to run createDataPartition
in caret.
Error in createDataPartition(data1, p = 0.8, list = FALSE) :
y must have at least 2 data points
I ran the same exact same code last night with no errors. Any thoughts?
predictors<- with(df, data.frame(xvar, xvar, xvar, xvar))
data1<-with(dfu2, data.frame(data1))
library(caret)
set.seed(1)
trainingRows<- createDataPartition(data1,
p=.80,
list=FALSE)
> dput(head(data1, 15)) structure(list(data1 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L)), .Names = "data1", row.names = c(NA, 15L), class = "data.frame")
The data frame data1
is clearly visible in my environment and has the expected observations. Any thought?