Hi! I am having difficulty knitting R with the following codes. The function accuracy () works properly to give its outputs in an rmd file, but when I attempted to knit it, I received the error depicted in the image below.
Thank you for your work! The data I pulled off the training & test set was writing series from the package fpp2? Unfortunately, even after using your codes, I still fail to knit it with the same error message.
# Split into a 80-20 on training & test data
w_training = window(w_data, start=1968, end=c(1975,12))
#> Error in window(w_data, start = 1968, end = c(1975, 12)): object 'w_data' not found
# w_training = head(w_data, 96)
w_test = window(w_data, start = 1976)
#> Error in window(w_data, start = 1976): object 'w_data' not found
# w_test = tail(w_data, 24)
# library(e1071)
# library(caret)
# library(dplyr)
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
naive_test = stlf(w_training,t.window=13,lambda = BoxCox.lambda(w_training),s.window="periodic",robust=TRUE,method="naive",h=length(w_test))
#> Error in NCOL(x): object 'w_training' not found
accuracy(naive_test, w_test)
#> Error in accuracy(naive_test, w_test): object 'naive_test' not found
rwdrift_test = stlf(w_training,t.window=13,lambda = BoxCox.lambda(w_training),s.window="periodic",robust=TRUE,method="rwdrift", h=length(w_test))
#> Error in NCOL(x): object 'w_training' not found
accuracy(rwdrift_test, w_test)
#> Error in accuracy(rwdrift_test, w_test): object 'rwdrift_test' not found
This is two separate reprexes. As you can see from the errors, the second one can't access the data. If you put them in the same reprex, it should work.