相关疑难解决方法(0)

如何将 sjPlot 包中的 html sjtable 转换为 Latex

sjPlot 包(http://www.strengejacke.de/sjPlot)具有 tab_model() 函数,可以为许多模型类型创建漂亮的 html 表格。我正在尝试在 Overleaf 中使用这些表格,但我不确定如何“轻松”将它们转换为乳胶而不丢失一些格式等。

\n

我的非常hacky方法如下(发布在https://github.com/Rapporter/pander/issues/298)。

\n

任何改善这一点的帮助将不胜感激。

\n

下面是一个可重现的示例:

\n
library(lme4)\nlibrary(sjPlot)\nlibrary(XML)\nlibrary(RCurl)\nlibrary(rlist)\nlibrary(janitor)\nlibrary(dplyr)\nlibrary(knitr)\n\n# This is a terrible model\nmodel = lmer(mpg ~ cyl * disp + (1|vs), mtcars)\n\n# We save the sjPlot table to an .html file (see the table below)\nsjPlot::tab_model(\n  model,\n  show.r2 = TRUE,\n  show.icc = FALSE,\n  show.re.var = FALSE,\n  p.style = "scientific",\n  emph.p = TRUE,\n  file = "Downloads/temp.html")\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

现在我们可以读取 .html 文件并对其进行一些清理:

\n
tables <- list.clean(readHTMLTable("~/Downloads/temp.html"), fun = is.null, recursive = …
Run Code Online (Sandbox Code Playgroud)

latex r

2
推荐指数
1
解决办法
2579
查看次数

标签 统计

latex ×1

r ×1