Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I want to run these chunks by clicking on the green arrow (top right):

enter image description here

But this doesn't work in RStudio, is this a feature or a bug?

like image 472
16 revs, 12 users 31% Avatar asked Feb 13 '18 10:02

16 revs, 12 users 31%


1 Answers

This has not been implemented in RStudio yet, and probably won't be for some time.

However, you can write your R code in a separate file, reference it in R Markdown chunks, and execute those chunks interactively in RStudio. The way to do this is with knitr's code externalization feature. You can read about how to use it in R Markdown notebooks here:

https://rmarkdown.rstudio.com/r_notebooks.html#executing_code (scroll down a bit to Executing External Chunks)

More on code externalization with knitr here:

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

like image 141
Jonathan Avatar answered Nov 12 '22 04:11

Jonathan