【问题标题】:Instruct R Markdown to ignore the rest of content from a specific point [duplicate]指示R Markdown忽略特定点的其余内容[重复]
【发布时间】:2019-09-03 06:56:21
【问题描述】:

我没有这个问题的代码,希望我能解释一下。 当我在编辑我的rmarkdown 文件时,我想编织它以查看它在此之前的样子。我只想看看它在这之前的样子,而不是每次都编织整个文件。我想知道我们是否可以插入标记或其他东西,因此文件的其余部分将被忽略或视为纯文本。

我已尝试添加 ````。它将其余文本的颜色更改为橙​​色,但仍运行其中的内联代码。

```{r setup,echo=FALSE}
run this
```
Chapter 1 with inline code `r code` and text, 
edit this `r code`, knit until this point ignoring the rest:  
Chapter 2.... ... Chapter 10 with a lot of inline code. 

【问题讨论】:

    标签: r r-markdown


    【解决方案1】:

    在 Rmarkdown 中,你有一个代码块

    ```{r [options]}
    your code
    ```
    

    对于选项,您有 eval、echo、messages 等,但美妙之处在于它们被传递作为渲染工作。所以你应该能够做类似的事情:

    ```{r setup,echo=FALSE}
    run this
    ```
    
    I am doing code stuff! *Yeah*
    
    ```{r load_data}
    More code
    evalfromhere=FALSE
    ```
    
    ```{r step2b,eval=evalfromhere}
    Doesn't work yet
    ```
    
    ```{r name2,eval=evalfromhere}
    Also not yet
    ```
    

    一旦您满意,将evalfromhere 设置为TRUE,或删除块选项。

    Rmarkdown 基于knitr,请阅读以下文档:https://yihui.name/knitr/options/

    【讨论】:

    • 感谢@MrGumble 回答我的问题。我已经修改了我的问题。我试图找到一种快速的方法来告诉 knitr 不要使用内联代码以及几个块来编织文本文件的其余部分。
    猜你喜欢
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-19
    • 1970-01-01
    • 2012-12-06
    • 2011-01-23
    • 1970-01-01
    相关资源
    最近更新 更多