将.rmd文件编织为.md并将.md文件另存为一个不同的名称

我有一个名为mycode.rmd.rmd文件保存在github上名为root/scripts的子目录中。

R Markdown
========================================================

I'd like to find a way to 'knit to HTML' in RStudio and have the resulting .md
file save one level up in the root directory with a different name, README.md, 
so Github will display it.

```{r, results='hide'}
math <- 1 + 1
```

这样,根文件夹中的README.md将始终与root/scripts '真正' .rmd文件保持.rmd 。 在mycode.rmd工作时,我最想做的事情是从RStudio按'编辑为HTML'。

在这里输入图像描述

更新

基于@Thomas评论的解决方案:

Here is one option:

```{r, include=FALSE}
   # add this chunk to end of mycode.rmd
   file.rename(from="scripts/mycode.md", 
               to="README.md")
```

基于@Thomas评论的解决方案:

这里有一个选项:

```{r, include=FALSE}
   # add this chunk to end of mycode.rmd
   file.rename(from="scripts/mycode.md", 
               to="README.md")
```
链接地址: http://www.djcxy.com/p/75561.html

上一篇: knit .rmd file to .md and save the .md file one level up with a different name

下一篇: Execute a forEach like a waterfall in async