简体   繁体   English

rmarkdown从RStudio内部运行子块

[英]rmarkdown running child chunks from inside RStudio

I've been moving some of the code for a report I'm writing to child .rmd files. 我一直在为我正在写给孩子.rmd文件的报告移动一些代码。 I want to run these chunks by clicking on the green arrow (top right): 我想通过单击绿色箭头(右上角)来运行这些块:

在此输入图像描述

But this doesn't work in RStudio, is this a feature or a bug? 但这在RStudio中不起作用,这是一个功能还是一个bug?

This has not been implemented in RStudio yet, and probably won't be for some time. 这还没有在RStudio中实现,可能不会持续一段时间。

However, you can write your R code in a separate file, reference it in R Markdown chunks, and execute those chunks interactively in RStudio. 但是,您可以在单独的文件中编写R代码,在R Markdown块中引用它,并在RStudio中以交互方式执行这些块。 The way to do this is with knitr's code externalization feature. 这样做的方法是使用knitr的代码外化功能。 You can read about how to use it in R Markdown notebooks here: 您可以在此处阅读有关如何在R Markdown笔记本中使用它的信息:

https://rmarkdown.rstudio.com/r_notebooks.html#executing_code (scroll down a bit to Executing External Chunks ) https://rmarkdown.rstudio.com/r_notebooks.html#executing_code (向下滚动一下执行外部块

More on code externalization with knitr here: 有关使用knitr进行代码外部化的更多信息:

https://yihui.name/knitr/demo/externalization/ https://yihui.name/knitr/demo/externalization/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM