Suggestion for a new feature in RStudio: "Toggle" lines of code to run in development mode.
Use Case: I am developing code and have many diagnostic type commands within the code - that check out data, say using head(), glimpse(), or that produces interim graphs - so that I can check out that my code is running correctly. Perhaps some of these commands take a while to run.
But, if I am generally happy with the code and want to run whole blocks of code, say from line 1 to my current line (say using ctrl+alt+B), my diagnostic commands throughout the code will run again, slowing down the process. I could go back and comment out all my diagnostics, but then if I want them back I have to uncomment them.
Would there be a way to click/toggle a button in RStudio that would skip over designated (diagnostic) code? Perhaps the diagnostic code lines could be prefixed with "*" so that RStudio can know which lines to skip when the button is depressed.
Hi Kevin thanks for the response! But in that case for every diagnostic command I type would have to prefix it with "if (verbose) ..." I was hoping there could be a simple button toggle and maybe a simple special (1) character prefix in front of diagnostic code, such as * head(). Currently, I have a global variable that I set, and a common diagnostic function runs, or doesn't run, depending on whether I set the global variable to 'y' or 'n' (like as you suggested) but this only works for functions that I have written that check for the global variable toggle, not for simple glimpse()'s for example.