Option to disable clearing of output source view


I was a Jupyter notebook user for a long time and recently I decided to give RStudio a try because of better R support.

So far, its been fine experience. However, there is one thing that is very annoying. Anytime when I save a qmd document (which has been modified) within source view, the inline output of all the cells is cleared. This also happens when I add a cell, then usually all the outputs below are also cleared. In Jupyter, the output of the cells stays visible until the same cell is re-run (without affecting all other cells); saving do not affect the output. This is crucial for interactive analysis, since many times the computation within cells is time-consuming; I do not want to re-run the whole document just because I saved a file or added a new cell.

The same does not happen in Visual view. However, I'm a long time user of Vim keybindings, which unfortunately do not work in Visual view and not having it really hurts my productivity...

Maybe I'm missing something, is this a bug or can it be already disabled? Thanks.

You may be applying the Jupyter framework inappropriately to RStudio by working in qmd. Quarto documents shine in combining text and displaying results of code in a form ready to introduce to others as a publication in some non-interactive format. But you're right—you don't want to be re-rendering long-running snippets frequently. To avoid this using the source pane make sure the render on save box is unchecked.

Should work because inline code and chunks (terminology in place of cells) won't be reevaluated.

I've found in authorizing Quarto documents that writing a script designed to only assign objects works well in the setup chunk with source(script.R) and those objects can be called in later chunks or inline as needed later in the document. For me that also has the advantage of doing programming in the IDE and leaving the work of presentation to Quarto, rather than trying to keep an eye both on logic and display at the same time.

Thanks for the reply. Unfortunately, I already have this checkbox unchecked. And now I just tried it on a new project where I have two R cells, each evaluating a single expression. After CTRL+S, the outputs of the cells are gone...

My understanding was that qmd was an answer of R community to evergrowing Jupyter notebook popularity. That is, to provide some sort of notebook interface with possibly many languages within one document (which actually works well!). Definitely, publishing a document using Quarto is more polished than from other projects tailored for Jupyter notebooks (there is a project jupyterbook that does the similar thing for Jupyter, but I had some problems with it with large documents - the outline was unsychronized with the actual content).

I still believe that it is probably a bug as it works in Visual mode. However, as Quarto is able to publish reports from Jupyter notebooks, maybe I will go back to Jupyter notebooks and just publish them using Quarto.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.