c) Split the data into a training set and a test set. code example
Example: how to split train and test data in r
library(caTools)
sample <- sample.split(data$y, SplitRatio = 0.7)
train_data <- subset(data, sample == TRUE)
test_data <- subset(data, sample == FALSE)