At the beginning of your Rmd file, add a chunk that spins your Rmd file to an R script.
https://www.garrickadenbuie.com/blog/convert-r-markdown-rmd-...
Now you have:
- single file (Rmd, plain text) where you can do any edits, which, when compiled, produces:
- (1) you get story, code and results in a single package: one output file (usually, html), where all inputs and outputs are stored together (or, just the outputs, if you turn off echo'ing, e.g. for producing a report),
- (2) you get the code: another output file, which is a simple R script version of your Rmd file.
Code updates to the Rmd are viewable much easier on the output R script (#2), which is also much more convenient for debugging. For static text updates, I look at the Rmd file. For content updates (e.g. did my data change between the runs?), I look at the html (or Word or PDF etc) file (#1).