i need help with createDataPartition I am getting this error
Error in createDataPartition(TBdta$medv, p = 0.8, list = FALSE) : y must have at least 2 data points
my code
library(tibble)
dta <- url("http://course1.winona.edu/bdeppa/Stat%20425/Data/Boston_Housing.csv")
TBdta <- as_tibble(read.csv(dta, check.names = FALSE))
TBdta
My error comes when i run the below chunch
# Split out validation dataset
# create a list of 80% of the rows in the original dataset we can use for training
set.seed(7)
validationIndex <- createDataPartition(TBdta$medv, p=0.80, list=FALSE)
# select 20% of the data for validation
validation <- TBdta$medv[-validationIndex,]
# use the remaining 80% of data to training and testing the models
dataset <- TBdta$medv[validationIndex,]
Error in createDataPartition(TBdta$medv, p = 0.8, list = FALSE) : y must have at least 2 data points