rsjplot

How to save the output of tab_model()


Data exempel:

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

How can I know save the output of the tab_model() function below? The tab_model() function is part of the sjPlot package. There has to be a nother way than to take a screenshot or?

tab_model(lme1)

enter image description here


Solution

    1. You could use webshot package:

    2. With file option first save an .html file

    3. Then use webshot to make a .png file

    See my example with 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")