knit .rmd file to .md and save the .md file one level up with a different name
I have a .rmd
file called mycode.rmd
saved in a subdirectory called root/scripts
on 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
```
This way README.md
in the root folder will always be up to date with my 'real' .rmd
file in root/scripts
. The most I want to do to make this happen is press 'knit to HTML' from RStudio when working on mycode.rmd
.
Update :
A solution based on comments from @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")
```
A solution based on comments from @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")
```
链接地址: http://www.djcxy.com/p/75562.html