r - 将 .rmd 文件编织为 .md 并使用不同的名称将 .md 文件上一级保存

标签 r github markdown knitr rstudio

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

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根文件夹中的内容将始终与我的“真实”保持同步 .rmd文件在 root/scripts .我最想做的就是在处理 mycode.rmd 时从 RStudio 按下“knit to HTML”。 .

enter image description here

更新 :

基于@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")
```

关于r - 将 .rmd 文件编织为 .md 并使用不同的名称将 .md 文件上一级保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19989325/

相关文章:

r - 无法在 Ubuntu 18.04 上的 R Studio Server 中安装 aws.s3 包 - 权限被拒绝?

r - R的randomForest包中缺失值错误

github - 将链接放置在 Markdown 代码块内

git pull origin master 给出 merge 冲突 : what should I do?

javascript - 如何使用 Javascript 正则表达式检测没有评论和 Markdown 的句子?

r - 是什么导致我的 R 脚本文本消失?

Git rebase 导致 pull request 在自动 merge 中失败

rust - 在 Rust 中推送运行时操作以编译时间?

angularjs - 在 angularJS 中,如何将包含标记的模型渲染为标记(未转义)

r - R 中 lpSolve 中的绝对值约束