I am trying to split my dataset longitudinally by year into training (entries from year <= 2004) and testing (>2004). I know how to split using caret for random sampling but am not sure how to modify for a particular year.
The time column is in year-month-day and time sample was collected.
I have looked into the createTimeSlices function in the caret package but do not understand how to specify a particular year to slice by. It appears that createTimeSlices is meant for Cross Validation?
Any ideas of a package I can use to solve this?