Splitting data into training and test data

Hello,

first of all, see our homework policy in the forum. However, there are numerous ways to do this. You could either use base R functions like %in% to specify a range of Dates and subset based on this range. Or you make use of mroe advanced packages likes lubridate and dplyr or even data.table and collapse, which offer specific functions to handle the conversion of dates between numerous formats.

Without representative sample data (e.g. a reprex, see here for more informations) you will not get any additional informations or even working code I believe, since it would be against the homework policy..

But maybe the suggested base R method or the packages I mentioned are enough to get you started, since subsetting is a rather basic task which should be rather easy, compared to advanced machine learning techniques.

Kind regards