Search code examples
rfunctionrstudioenvironmentfold

how to keep folded functions folded when I open my .R file on another device. rStudio


I m going to email my .R codes.
it would be great if my receiver can also open .R file and get my folded functions folded. ( neat and readable )
how is this achieved in Rstudio?


Solution

  • According to code folding in Rstudio

    Folded regions are preserved while editing a document; however all foldable regions are shown expanded by default when a file is closed and re-opened.

    But, we can use short-cuts as mentioned in the post if we want to expand all/collapse all

    Edit -> Folding:

    Collapse — Alt+L

    Expand — Shift+Alt+L

    Collapse All — Alt+O

    Expand All — Shift+Alt+O