【问题标题】:How to save the output of tab_model()如何保存 tab_model() 的输出
【发布时间】:2021-04-27 10:01:56
【问题描述】:

数据示例:

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

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

tab_model(lme1)

【问题讨论】:

  • 你能补充一点关于你的目标的信息吗?您想以编程方式处理信息吗?嵌入文档(什么格式?Word文件?)broom.mixed::tidy()之类的函数也可以捕获信息
  • 我只是想将表格保存为 pdf 或类似的格式。

标签: r sjplot


【解决方案1】:
  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")

【讨论】:

    【解决方案2】:

    你可以这样写:

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

    #lme1 可以是任何模型

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2022-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-24
    • 1970-01-01
    • 2021-08-05
    • 2012-03-30
    • 2011-10-31
    相关资源
    最近更新 更多