Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:将随机林模型打印到html_Html_R_Knitr_Random Forest_R Markdown - Fatal编程技术网

R:将随机林模型打印到html

R:将随机林模型打印到html,html,r,knitr,random-forest,r-markdown,Html,R,Knitr,Random Forest,R Markdown,我正在编写一个Rmd文档,我希望通过RStudio中提供的html导出机制,使用knitr包将其编译成html。可使用以下代码再现此问题: 示例 是否可以强制将randomForest输出到一个漂亮的html表格中,该表格将显示在一个降价文档中?您需要查看str(dummy)并确定需要该列表对象的哪些部分。dataframe类用于在等长列中保存数据,而不是用于任意结构化对象。有时你真正想要的东西会在摘要(虚拟)-对象中的某个地方组装起来。添加此功能应该不会太难,请提交一张票证(或拉一个请求),我

我正在编写一个Rmd文档,我希望通过RStudio中提供的html导出机制,使用knitr包将其编译成html。可使用以下代码再现此问题:

示例


是否可以强制将
randomForest
输出到一个漂亮的html表格中,该表格将显示在一个降价文档中?

您需要查看
str(dummy)
并确定需要该列表对象的哪些部分。dataframe类用于在等长列中保存数据,而不是用于任意结构化对象。有时你真正想要的东西会在
摘要(虚拟)
-对象中的某个地方组装起来。添加此功能应该不会太难,请提交一张票证(或拉一个请求),我会很乐意进行调查。@daroczig谢谢你的建议,当然,我会提交票证的。
# Set up
rm(list = ls())
data(airquality)
attach(airquality)
packs <- c("randomForest", "knitr", "xtable", "xtable", "stargazer")
lapply(packs, require, character.only=T, quietly = TRUE, warn.conflicts = FALSE)

# Model
airquality <- na.roughfix(airquality)
dummy <- randomForest(Ozone ~., data = airquality)

# Problem
kable(dummy)
xtable(dummy)
stargazer(dummy)
> # Problem
> kable(dummy)
Error in as.data.frame.default(x) : 
  cannot coerce class "c("randomForest.formula", "randomForest")" to a data.frame
> xtable(dummy)
Error in UseMethod("xtable") : 
  no applicable method for 'xtable' applied to an object of class "c('randomForest.formula', 'randomForest')"
> stargazer(dummy)

% Error: Unrecognized object type.