CreateDataPartition gave me an error: "data" must be of vector type, was "NULL"

I got below error while I was trying to use the CreateDataPartition () function from the caret package. Here the y variable takes a vector and I am passing a column from my data.frame. Hope it's in the correct format. I still don't understand why this is giving me an error.

My code:

bikeInTrain<-createDataPartition(y=bikeTrainRaw$datetime, p=0.7,list = FALSE)

Mistake:

Error in matrix(unlist(out), ncol = times) : 'data' must be of a vector type, was 'NULL'

the datetime column has a factor class. Should I change this to something else? Let me know If I'm wrong somewhere.

+3
r


source to share


No one has answered this question yet

Check out similar questions:

3
bind_rows of different data types
1
Calculate diff in data.frame
1
R vectorized matrix to numeric data frame with preserving factors
1
Warning: Error in match.arg: 'arg' must be NULL or a character vector
1
How do I resolve the R mosaic error R: "data" must be of vector type, was "NULL"?
0
Failed to save data.frame after using group_by and summarize functions in R (dplyr)
0
Data format for regression with e1071 package
0
Matrix inversion of R using solution and others (error 'a' must be a complex matrix)
0
Check partial dataframe of p-values ​​above 1 if set to 1
-2
Choroplethr error message



All Articles
Loading...
X
Show
Funny
Dev
Pics