2013-07-11 8 views
13

knitr का उपयोग कर मैं जानता हूँ कि इस php और अन्य भाषाओं के साथ किया जा सकता है, लेकिन सोच रहा था कि क्या निम्नलिखित पूरा किया जा सकता knitr का उपयोग कर:डालने भाग

चलो कहते हैं कि मैं एक Rmarkdown है (चलो .rmd) दो शीर्षक 1 वर्गों के साथ दस्तावेज़:

# This is the first heading for the first document 
Lorem ipsum dolor sit amet 

# This is the second heading for the first document 
plot(object) 
  1. प्रश्न 1: अगर खुला एक और .rmd दस्तावेज़, मैं कैसे एक लिंक बना सकते हैं ताकि जब पार्स इस दस्तावेज़ अपनी सामग्री के साथ ही शुरू हो जाएगा पहले दस्तावेज़ से पूरी सामग्री। उदाहरण के लिए:

    # This is the first heading for the second document 
    Lorem ipsum dolor sit amet 
    
    [command goes here to insert the first document] 
    

    परिणाम होगा:

    # This is the first heading for the second document 
    Lorem ipsum dolor sit amet 
    
    # This is the first heading for the first document 
    Lorem ipsum dolor sit amet 
    
    # This is the second heading for the first document 
    [plot shows up here] 
    
  2. प्रश्न 2: मुझे का चयन करें और दस्तावेज़ 2 में दस्तावेज़ 1 के केवल चयनित अंश डालने की अनुमति knitr हैं? उदाहरण के लिए, केवल 1 शीर्षक और इसके नीचे सामग्री, या केवल 2 और जिसका कथानक

+1

आप बच्चे को दस्तावेजों के माध्यम से पहली बात कर सकते हैं। [यह] देखें (https://github.com/yihui/knitr/issues/268)। दूसरा एक ट्रिकियर है और इस बात पर निर्भर करता है कि आप कैसे परिभाषित करना चाहिए और क्या नहीं करना चाहिए। – Ramnath

उत्तर

21
  1. वह यह है कि क्या हिस्सा विकल्प child के लिए है, उदाहरण के लिए शीर्षक second.Rmd में, आप

    ```{r child='first.Rmd'} 
    ``` 
    
  2. कि एक छोटे से थोड़ा जटिल काम है, लेकिन आप knit_child() मैन्युअल कॉल कर सकते हैं कर सकते हैं, उदाहरण के लिए

    ```{r echo=FALSE, results='asis'} 
    # knit the first three lines of first.Rmd 
    cat(knit_child(text = readLines('first.Rmd')[1:3]), sep = '\n') 
    ``` 
    
+1

यहुई, एक टन धन्यवाद, यह वही था जो मैं –

+1

की तलाश में था, इस बात से अवगत रहें कि बच्चे के एमडी दस्तावेज़ में स्तर 1 शीर्षलेख बुकडाउन में अलग अध्याय के रूप में बुना जाएगा। – Phil

संबंधित मुद्दे