kable 表输出中的错误 PDF 不使用 save_kable 导出 & as_image 出错

问题描述

当我使用 save_kable(file="out.pdf") 运行代码时,没有输出。当我使用 HTML 而不是 Latex 时有一个输出,但是该输出的格式不像 Latex 那样。然后,如果我尝试 as_image() 而不是 save_kable ,我会收到以下错误。我使用的是 Windows 10。

    library(tidyverse)
    library(kableExtra)
    library(webshot)
    webshot::install_phantom_js

    out_1 <- kable(mtcars,"latex",booktabs = T,align = "c",digits = 2,linesep = "\\addlinespace") %>%
      kable_styling(latex_options = c("solid","scale_down")) %>%
      save_kable(file="C:\\Users\\Documents\\out_1.pdf") # this does not successfully output

    out_1 <- kable(mtcars,"scale_down")) %>%
      as_image(file="C:\\Users\\Documents\\out_1.pdf") # this prompts error

我遇到的错误是: save_kable_latex(x,file,latex_header_includes,keep_tex,density) 中的错误: 我们在尝试使用 magick 读取生成的 PDF 文件时遇到错误。您可以检查您的magick 安装并尝试使用magick::image_read 手动读取PDF 文件。也有可能你没有安装 ghostscript。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)