I am trying to split a data set into training and test set with these codes
table (A)
A
No Yes
21343 4419
set.seed(88)
split <- sample.split(mydata$A, SplitRatio = 0.75)
train <- subset(mydata, split == TRUE)
test <- subset(mydata, split == FALSE)
table(train$A)
No Yes
16007 3314
>table(test$A)
No Yes
5336 1105
I want to ask that is there any way to get equal number of responses in training or test set?? that is, for training set number of responses for YES and NO will be 3314 ??