Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rstudio Global Changes: show chunk output in console via CLI?

Tags:

r

rstudio

How can I force RStudio (v1.1.383) to evaluate R chunks always in console (instead of inline) when working with Rmarkdown documents, using a script?

I know I can set up Output chunks in Console by clicking on it: enter image description here

According to this RStudio support post I could also un-check 'Show output inline for all R Markdown document' under 'Tools -> Global Options...': enter image description here

But, is there a way to do it from a command line?

The reason I ask is that, I often work on my university machines and they all restore to defaults after each reset. Each time when in class, we have to manually go thru menus.

Knowing how to do it via a console command would as useful as starting each of my classes with rm(list=ls())

like image 406
blazej Avatar asked Jan 05 '18 09:01

blazej


1 Answers

There's not currently an elegant way to do this. This preference is stored inside an internal RStudio state file, in %localappdata%\RStudio-Desktop\monitored\user-settings. If you're sufficiently motivated you can write a script which sets the rmd_chunk_output_inline preference, but it's going to be unpleasant.

One thing you can do is set the chunk output type in the YAML header, like this:

---
editor_options: 
  chunk_output_type: console
---

You could also use an R Markdown document template with this set up for you (maybe your script could write this out).

Finally, there's an open issue for this on RStudio's github page which you might comment on and/or vote for:

https://github.com/rstudio/rstudio/issues/1607

like image 97
Jonathan Avatar answered Nov 03 '22 21:11

Jonathan