splitTrainTest | R Documentation |
This function splits a time series object into training and testing sets.
splitTrainTest(dat, numTrain = length(dat) - 10)
dat |
A time series object (of class 'ts'). |
numTrain |
An integer specifying the number of observations to include in the training set. Defaults to 'length(dat) - 10'. |
A list containing:
train |
A time series object containing the training data. |
test |
A time series object containing the testing data. |
ts_data <- ts(1:100, start = c(2000, 1), frequency = 12)
split_data <- splitTrainTest(ts_data, numTrain = 80)
train_set <- split_data$train
test_set <- split_data$test
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.