gpt4 book ai didi

RMarkdown 代码评估直到命令

转载 作者:行者123 更新时间:2023-12-01 12:25:54 25 4
gpt4 key购买 nike

我在构建分析时使用 RMarkdown。最终输出将是一个 html 文档。实际上我有一个核心代码,这将是最终文档,在结束之后,我有很多代码行,其中包含 目前 没有用的 block 和句子,但可能是包含在最终文件中。

    是否存在告诉 RMarkdown 评估代码直到该点的命令?

不仅仅是eval=FALSE对于 block (我也有纯文本),但类似于 \end{document}TeX 中。我不想只评论纯文本并输入 eval=FALSE作为 block 选项。

我尝试用谷歌搜索并阅读 RMarkdown 文档,但一无所获。

谢谢大家!请原谅我糟糕的英语...

最佳答案

来自 knit_exit() 的文档:

Sometimes we may want to exit the knitting process early, and completely ignore the rest of the document. This function provides a mechanism to terminate knit().

例子:

Text.

```{r}
print(1)
```

More text.

```{r}
knitr::knit_exit()
```

Ignored.

```{r}
print("Ignored.")
```

knit_exit() 之后的所有内容都将被忽略。这适用于所有输出格式。

上面的代码产生:

enter image description here

关于RMarkdown 代码评估直到命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39745098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com