将图像导入R标记文件时出现问题



我正在学习R标记,目前正试图根据这个优秀的网站添加图像https://www.earthdatascience.org/courses/earth-analytics/document-your-science/add-images-to-rmarkdown-report/我已经保存了狗的示例图像,但在将其导入最简单的R标记文件时遇到问题。我已经尝试了几种方法(不仅仅是网站上描述的方法(。我在Rstudio用针织品。

第一种不起作用的方法是在我的工作目录下提供子文件夹(我也尝试过在"images"之前不加斜线,并提供完整的路径名(。

---
title: "myImage"
output: html_document
---
This is a markdown to display an image
![an image caption Source: Ultimate Funny Dog Videos Compilation 2013.](/images/silly-dog.png)

我也试过,但这也不起作用

---
title: "myImage"
output: html_document
---
This is a markdown to display an image
```{r}
knitr::include_graphics("C:/Users/myname/Documents/Programs//R/images/silly-dog.png")
```

在这两种情况下,R都表示找不到图像文件";在资源路径"中找不到文件/images/sily-dog.png;(但它就在那里——在images子文件夹中(非常感谢任何提示

很抱歉,我发现了这个问题,它很愚蠢。当我右键单击文件夹中的图像并复制路径时,我发现该文件实际上名为silly-dog.png.jpg这现在可以

![an image caption Source: Ultimate Funny Dog Videos Compilation 2013.](/Users/berna/Documents/Programs/R/images/silly-dog.png.jpg)

很抱歉耽误了你的时间

最新更新