Home > OS >  How to hide code in RStudio like in Pycharm?
How to hide code in RStudio like in Pycharm?

Time:04-09

I am working exploratively in RStudio and have quite frequently the situation that a certain part of my code should not be executed. Additionally I want to avoid that this part of my code distracts me.

In Pycharm, I can use the code folding possibilities of the IDE. By folding the code interactively (clicking on the "minus" button at the if statement) these things that are not needed presently are not visible anymore to me. If needed I can unfold the section and change the if statement accordingly.

not folded


folded

Is there something similar possible with RStudio?

CodePudding user response:

Yes we do have similar functionality in Rstudio. As long as your code is wrapped with curly bracket {}, it can be folded and unfolded.

Unfolded:

unfolded

Folded (click on the little downward arrow next to the number line to fold it):

Just click on the yellow part to expand it again

folded


More information on the enter image description here

enter image description here

  • Related