如何保存 tab_model() 的输出

How to save the output of tab_model()

数据示例:

lme1<- lme(total.fruits ~ rack + nutrient + amd + status,
            random = ~1|reg, method = "ML", data=Arabidopsis)

我怎么知道保存下面 tab_model() 函数的输出? tab_model() 函数是 sjPlot 包的一部分。他们必须是截屏或其他方式吗?

tab_model(lme1)

  1. 您可以使用 webshot 包:

  2. 使用 file 选项首先保存一个 .html 文件

  3. 然后用webshot制作.png文件

查看我的 mtcars 示例:

library(nlme)
library(sjPlot)
library(webshot)
lme1<- lme(mpg ~ cyl +  disp + hp,
           random = ~1|disp, method = "ML", data=mtcars)

# first save table to html file
tab_model(lme1, file = "plot.html")

# then take this html file and make .png file
webshot("plot.html", "plot.png")

你可以这样写:

library(sjPlot)
tab_model(lme1, file = "YOURTABLENAME.doc")

#lme1可以是任意型号