Learn R Programming

CombMSC (version 1.4.2.1)

splitTrainTest: Split a time series into training and testing sets

Description

Given a time series, this function splits it into two, depending on the length of numTrain. The first numTrain observations go to the training set, the remainder into the testing set, while retaining the time series attributes of both objects and correctly adjusting the start times and frequencies of both sets.

Usage

splitTrainTest(dat, numTrain = length(dat) - 10)

Arguments

dat

Time series

numTrain

The number of observations to keep in the training set