rmarkdown中采购参考:解决方法 [英] sourcing References in rmarkdown: workaround
问题描述
我正在使用rmarkdown
软件包markdonw v2.在整个.Rmd文件中,我创建了指向网站或图像的链接
I am working with markdonw v2, the rmarkdown
package. Throughout the .Rmd file, I create links to websites or images
[Link1][pathLink1]
![Image1][pathImage1]
然后,在文档末尾提供参考
then, at the end of the document I give the references
[pathLink1]:http://website.com/linkes/Link1.md
![pathImage1]:./images_rmd/
还有其他报告谈论相同的引用并在不同的上下文中使用相同的图像.我想创建一个包含所有链接和路径定义的单独文件,以便像在R环境中调用该文件一样,可以在每个.Rmd文件的末尾简单地获取它.
There are other reports that talk about the same citation and use same images in different contexts. I would like to create a separate file containing all the links and path difinitions, so that I could simply source it at the end of each .Rmd file, like I would call in an R environment
source(/Rcode1.R)
问题:我如何来源" .Rmd中的另一个文件,以便源代码将所需的文本字符串打印到.Rmd文件中?
Question: How do I "source" another file in .Rmd, so that the sourced code prints needed text strings into the .Rmd file?
这将为HTML和PDF中的引文和科学论文撰写提供一些帮助.
This would offer some help with citations and scientific paper composition in HTML and PDF.
推荐答案
http://yihui.name /knitr/demo/child/
```{r child, child = '~/path/to/child.Rmd'}
```
以及类似的.Rnw文件:
and similarly for .Rnw files:
<<child, child = '~/path/to/child.Rnw'>>=
@
还有完整的示例: https://github .com/yihui/knitr-examples/blob/master/087-child-example.Rnw
这篇关于rmarkdown中采购参考:解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!