高级 `data.table` 在块中 运行 时工作正常,但在 `knit2html` 时出错
Advanced `data.table` working fine when run in chunk but error when `knit2html`
我尝试参考以下链接使用 data.table
包来计算 mape
、smape
、mse
、rmse
,它工作正常当 运行 在块中时下面的代码但在 knit2html
时变成错误。有人给我遮光吗?
- https://tysonbarrett.com/jekyll/update/2019/10/06/datatable_memory
- http://brooksandrew.github.io/simpleblog/articles/advanced-data-table
## 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 in `[.tbl_df`(seasonal_m1, , { :
object 'open.Point.Forecast' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> [ -> [.tbl_df
Execution halted
seasonal_m1 <- data.table(seasonal_m1)
setorder(seasonal_m1, index)
已解决,需要将seasonal_m1转换为data.table格式。 https://github.com/yihui/knitr/issues/1941#issuecomment-759275616
我尝试参考以下链接使用 data.table
包来计算 mape
、smape
、mse
、rmse
,它工作正常当 运行 在块中时下面的代码但在 knit2html
时变成错误。有人给我遮光吗?
- https://tysonbarrett.com/jekyll/update/2019/10/06/datatable_memory
- http://brooksandrew.github.io/simpleblog/articles/advanced-data-table
## 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 in `[.tbl_df`(seasonal_m1, , { :
object 'open.Point.Forecast' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> [ -> [.tbl_df
Execution halted
seasonal_m1 <- data.table(seasonal_m1)
setorder(seasonal_m1, index)
已解决,需要将seasonal_m1转换为data.table格式。 https://github.com/yihui/knitr/issues/1941#issuecomment-759275616