Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I tried to refer to below links to use data.table package to calculate mape,smape,mse,rmse, its working fine with below codes when run in chunk but become error when knit2html. Somebody shade me a light?

## https://tysonbarrett.com/jekyll/update/2019/10/06/datatable_memory
## http://brooksandrew.github.io/simpleblog/articles/advanced-data-table
require('DescTools')
require('data.table')

setorder(seasonal_m1, index)

open.accr <- seasonal_m1[, {
  open = open
  open.Point.Forecast = open.Point.Forecast
  .SD[, .(.N, open.mape = MAPE(open, open.Point.Forecast), 
          open.smape = SMAPE(open, open.Point.Forecast), 
          open.mse = MSE(open, open.Point.Forecast), 
          open.rmse = RMSE(open, open.Point.Forecast)), 
      by={index=as_date(index)}]}, 
  by=.(Model, Period)]

Error :

Error in `[.tbl_df`(seasonal_m1, , { : 
  object 'open.Point.Forecast' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> [ -> [.tbl_df
Execution halted

error knit2html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.8k views
Welcome To Ask or Share your Answers For Others

1 Answer

seasonal_m1 <- data.table(seasonal_m1)
setorder(seasonal_m1, index) 

solved, need to convert seasonal_m1 to a data.table format. https://github.com/yihui/knitr/issues/1941#issuecomment-759275616


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...