2013-11-14 6 views
6

साथ .md फ़ाइल एक स्तर ऊपर बचाने के लिए .rmd फ़ाइल बुनी मैं एक .rmd फ़ाइल mycode.rmd नामक एक उप-निर्देशिका github पर root/scripts बुलाया में बचाया है।.md और एक अलग नाम

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 रूट फ़ोल्डर में हमेशा अपने 'असली' .rmdroot/scripts में फ़ाइल के साथ तारीख तक हो जाएगा। ऐसा करने के लिए मैं सबसे अधिक करना चाहता हूं, mycode.rmd पर काम करते समय RStudio से '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") 
``` 
+1

जबकि आप इसे 'knit' के बाद' file.rename' के साथ नहीं ले जाते हैं? – Thomas

+0

... या आउटपुट फ़ाइल पथ को एक निर्देशिका स्तर निर्दिष्ट करें? – Thomas

+0

अब file.rename में देख रहे हैं। क्या आप knitr के लिए आउटपुट फ़ाइल पथ निर्दिष्ट कर सकते हैं जो एचटीएमएल पर बुनाई पर एमडी फाइलों को सहेजने पर नियंत्रित करेगा? मैंने सोचा कि आप केवल आंकड़े पथ निर्दिष्ट कर सकते हैं। –

उत्तर

3

एक समाधान @Thomas से टिप्पणी के आधार पर:

यहाँ एक विकल्प है :

```{r, include=FALSE} 
    # add this chunk to end of mycode.rmd 
    file.rename(from="scripts/mycode.md", 
       to="README.md") 
``` 
संबंधित मुद्दे