如何使用相对路径包含外部图形?
我开始我的 rmd 文件:
```{r setup,include=F}
knitr::opts_chunk$set(cache=F,echo=F)
knitr::opts_knit$set(root.dir = '/Users/dosc3612/odrive/CUDrive/real-time_interpolation',
child.path='/Users/dosc3612/odrive/CUDrive/real-time_interpolation')
```
Run Code Online (Sandbox Code Playgroud)
然后包括:
# Heading 1
some text referring to figure 1. 
Run Code Online (Sandbox Code Playgroud)
我的 rmd 文件在 /Users/dosc3612/odrive/CUDrive/real-time_interpolation/reports/real-time 中,所以我的理解是它将从该目录中查找数字。但基于块选项帮助我认为我可以使用 child.path 在文档中设置相对路径,但事实并非如此。
“data/gis”是“/Users/dosc3612/odrive/CUDrive/real-time_interpolation”中的子文件夹
谢谢
不确定这个问题是否仍然适用于任何人,但我遇到了类似的问题,无法让设置路径(root.dir、child.path 等)的任何选项起作用,但对于设置相对路径,这对我有用:

Run Code Online (Sandbox Code Playgroud)
的意思../是当前位置上一级目录,即../../表示从当前级别(在本例中为/Users/dosc3612/odrive/CUDrive/real-time_interpolation/reports/real-time)上两级目录(在在这种情况下 /Users/dosc3612/odrive/CUDrive/real-time_interpolation),在这种情况下,您将找到文件夹“data”和包含图形的子文件夹“gis”
| 归档时间: |
|
| 查看次数: |
826 次 |
| 最近记录: |