r - 工具未安装或不在 PATH 中:pdfcrop
问题描述
我是 R 新手,只是尝试将我的第一个 R Markdown 编成 pdf 作为我正在做的课程的一部分。卡住了警告消息(下面以粗体突出显示)。生成了 Pdf,但是该图根本没有被裁剪。看起来 RStudio 以某种方式无法找到 pdfcrop,尽管它已安装。我认为将其添加到路径中可能会起作用,但不确定如何执行此操作。以前,通过运行 Sys.setenv(R_GSCMD="C:/Program Files/gs/gs9.54.0/bin/gswin64.exe") 解决了与 Ghostscript 相同的问题。
非常感谢任何帮助和输入。提前致谢。
我做的步骤:
- 从 LateX 发行版安装 TinyTex。
- 安装的 Ghostscript
- 使用 tinytex::tlmgr_install("pdfcrop") 安装 pdfcrop
- Sys.which('pdfcrop'),它给出了一个空字符串 - “”我正在使用 windows O/S 和 Rstudio。
已创建输出:MyFirstRMarkDown.pdf 警告消息:在 has_crop_tools() 中:工具未安装或不在 PATH 中:pdfcrop -> 因此,图形裁剪将被禁用。
下面是源文件:
---
title: "My first R Markdown doc"
author: Sanjukta Samom
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
```{r}
print("Hello World")
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
解决方案
推荐阅读
- r - 应用函数修改 R 数据框列中的奇数行和偶数行
- reactjs - Typescript React - 与类型“IntrinsicAttributes”没有共同的属性
- c# - 从动作委托 C# 调用方法获取结果
- c++ - 你能告诉我下面的代码有什么问题吗?
- r-markdown - 执行当前 Rmarkdown 块并移动到 RStudio 中的下一个块
- ios - 实例成员“....”不能用于类型“CustomTextField”;你的意思是使用这种类型的值吗?
- laravel - 如何在 laravel 中正确实现 CRUD json 字段
- angular - 我需要根据用户选择有条件地渲染一个角度组件
- javascript - Jest helper-module-transforms 无法读取未定义的属性“值”
- android - 解决 Android API 29+ 上 EnterText 问题的扩展方法