I have a script that I compile directly into a report via CTRL-SHIFT-K
. While running, as an intentional side-effect this script creates HTML reports out of other scripts on which it depends.
The first time I run my collection of scripts (i.e. no HTML files or caches have yet been generated), I get the wrong report popping up in RStudio's built-in viewer-- instead of the script I directly invoked, the report is for the HTML report generated for one of its dependencies.
If I run it a second time, the correct report shows up.
I assume that CTRL-SHIFT-K
and the Compile Report
button call the compileNotebook
API function, and that is where the HTML to display is selected. How does compileNotebook
choose which HTML file to display? Does it look at creation/modification times, perhaps?
Is there a way to change its behavior or not open a preview window at all after compiling a report?
I realize that am posting this initially without a reprex. My hope is that somebody already knows the answer to the bolded question above, and that answer will give me an idea for a workaround.
If this question cannot be answered without a reprex, I'll update it after I have had some time to separate the non-relevant parts of my project and isolate just this behavior.