警告消息
In has_crop_tools() :
Tool(s) not installed or not in PATH: ghostcript
-> As a result, figure cropping will be disabled.
当一个简单的 R Markdown 文档被编织成 PDF 时出现:
---
output: pdf_document
---
![foo](bar.png)
The bar.png
图像已正确嵌入到 PDF 中,但看起来调用中存在拼写错误ghostcript
命令(不应该是幽灵s名字后面的脚本鬼脚本翻译?)。如何正确处理此警告消息?
My xfun::session_info()
output:
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042), RStudio 1.4.1103
Locale:
LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
LC_NUMERIC=C LC_TIME=English_United States.1252
Package version:
base64enc_0.1.3 compiler_4.0.4 digest_0.6.27 evaluate_0.14 glue_1.4.2 graphics_4.0.4 grDevices_4.0.4
highr_0.8 htmltools_0.5.0 jsonlite_1.7.1 knitr_1.31 magrittr_2.0.1 markdown_1.1 methods_4.0.4
mime_0.9 rlang_0.4.10 rmarkdown_2.7 stats_4.0.4 stringi_1.5.3 stringr_1.4.0 tinytex_0.27
tools_4.0.4 utils_4.0.4 xfun_0.19 yaml_2.2.1
你需要告诉 R 在哪里可以找到 Ghostscript。对于 Windows,请从以下位置下载 Ghostscripthttp://ghostscript.com/download/gsdnld.html安装ghostscript后,我们仍然需要告诉R在哪里可以找到ghostscript。为此,需要设置适应系统的 Path 变量:
进入控制面板 → 系统和安全 → 系统 → 高级系统设置 → 计算机名称、域和工作组设置 → 高级 → 环境变量
在系统变量中找到 Path 变量,选择它并单击编辑。
将 C:\Program Files\gs\gs9.23\bin (或安装 Ghostscript 的目录)添加到 Path 变量中。在 Windows 10 中,您可以通过单击“新建”并输入路径来执行此操作。在其他 Windows 版本中,只需将路径附加到变量值,并用分号分隔。
重新启动R
对于 MacOS,请从以下位置下载并安装 Ghostscript 9.23 软件包:http://pages.uoregon.edu/koch/重新启动R
我从这个网站找到了解决方案https://rnbeads.org/data/installing_rnbeads.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)