6

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

Quinten
  • 35,235
  • 5
  • 20
  • 53
Hillary Le
  • 103
  • 5
  • 2
    This doesn't work for me on Linux anymore either, largely because the phantomjs binary is no longer compatible with system libraries such as openssl. Perhaps it's the same issue on Windows? You could perhaps try this in Docker using an older version of Ubuntu or something to see if that works? – cmhh May 04 '22 at 06:40
  • 2
    I tried on a windows 10 machine and it crashed. But the following works, though without trimming all the whitespace of the resulting image: `dt |> kbl(caption = ...) |> kable_classic(...) |> save_kable("table_1A.html"); webshot::webshot("file:///c:/.../table_1A.html", "table_1A.png") `. So I guess it isn't phantomjs... at least not on Windows. – cmhh May 04 '22 at 07:22
  • 2
    save_kable is breaking for me too on Windows. "Error in webshot::webshot(file_temp_html, file, ...)" – Arthur May 31 '22 at 14:54

0 Answers0