'Separating chunks of code using commented line [closed]
I would like to separate my code using commented line to make them more readable like below:
# ----------------- reading data -------------------
df = cars
# ----------------- data Summary -------------------
summary(df)
just wondering if such an approach is common among experts to add something like titles in their scripts and whether there is a shortcut key to produce such lines: ------------ instead of repeatedly tapping on the - key?
Solution 1:[1]
A cool thing with RStudio is that you can do navigable sections:
# reading data ####
df = cars
# data Summary ####
summary(df)
You have to start with # and to finish with at least 4 # (or maybe this works too with 4 identical symbols).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stéphane Laurent |

