R: Error in webshot::webshot(file_temp_html, file, ...) when saving knitr table as image

931 Views Asked by At

yesterday I was able to save my knitted tables as images for figures in my paper. However, sometime in the evening something went awry while downloading other packages and now I cannot execute the code and am getting this error:

"Could not load  c:%5CUsers%5Clehi%5CAppData%5CLocal%5CTemp%5C1%5CRtmpKkDUDx%5Ctable_1A4e045152702b.html
 Error in webshot::webshot(file_temp_html, file, ...) : 
webshot.js returned failure value: 1"

5.stop("webshot.js returned failure value: ", res)

4.webshot::webshot(file_temp_html, file, ...)

3.save_kable_html(x, file, bs_theme, self_contained, extra_dependencies, 
density, ...)

2.save_kable(., file = "table_1A.png")

1.dt %>% kbl(caption = "Table 1: Pregnancy Data") %>% kable_classic(full_width = F, 
html_font = "Cambria") %>% save_kable(file = "table_1A.png")

Here is reproducible code:

library(knitr)
library(kableExtra)
library(tidyverse)
library(readxl)
dt <- mtcars[1:5, 1:6]
dt %>% 
  kbl(caption = "Table 1: Pregnancy Data") %>%
  kable_classic(full_width = F, html_font = "Cambria") %>% save_kable(file = "table_1A.png")

I have tried to update all the relevant R packages, I've tried clearing the temp files of junk, I've uninstalled and reinstalled R and Rstudio. I am completely stumped and would love some help.

enter image description here

0

There are 0 best solutions below