7

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?

3
  • At least knitting the thing works fine?
    – jay.sf
    Feb 13, 2018 at 11:25
  • 1
    indeed, but testing it locally before knitting is proving quite a pain!
    – pluke
    Feb 13, 2018 at 11:27
  • True. would be a nice feature, you should request it.
    – jay.sf
    Feb 13, 2018 at 11:32

1 Answer 1

3

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/

4
  • thanks Jonathan, I'll add a feature request and stick to executing external chunks
    – pluke
    Feb 14, 2018 at 18:34
  • 1
    @pluke wonder if anything has happened on this during the last 5 years. Aug 15, 2018 at 16:53
  • Five months I think? I put in a feature request, will have to check to see its status and link here
    – pluke
    Aug 15, 2018 at 17:17
  • the request is now here: community.rstudio.com/t/…
    – pluke
    Aug 21, 2018 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.