Can a notebook not be automatically knitted on save?

When I save my R notebook file, I believe the file is being processed in the background, executing the full notebook beginning to end?

I understand this is beneficial from a 'my_file.html output is always up to date' perspective, however, if their is heavy duty, long processing code in the file, I may not actually want to run the 'expensive parts' of the code:

1: my working space in memory has the model already
2: my changes do not invalidate that work, it may just be tweaking a graph output
3: I want to save my changes for the purposes of version control, my html output is not important to me at that moment

Is it possible to prevent this double execution problem through a setting or parameter?

The solution offered in this StackOverflow post is to change the output format of the document within your YAML metadata.

For example, currently you might have something like

output: html_notebook

which is what causes the document to be rendered on save. Changing it to html_document or just deleting it should stop the document from rendering on save.

1 Like

Agreed, just adding a link to the section on saving notebooks, where this is discussed in the R Markdown guide:

1 Like

Thanks muchly for the deets :slight_smile:

1 Like

Thanks, this is far neater than I expected. I had always just assumed (obviously wrongly) without that yaml argument the save would error (like if you have chunks named the same)!

This topic was automatically closed 7 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.