While writing complex codes in R & R Shiny, we often get errors while executing the codes. Mostly the reason being one has forgotten to add or remove a bracket or a comma, etc. This generally happens because R doesn’t automatically indents codes unlike Python where there is auto-indentation.
Indentation helps in making the complex code look very clean & readable. Hence many coders prefer to write their codes with indentation.

In R, we can also add indentation just by following these easy steps.

1. Click on “Tools” on top, choose “Global Options” in it.

2. Select “Code” & select 2 options :

3. Then click on “Display” & select the option “Show indent guides”.

4. Click “Apply” & then “OK”

5. Then paste a code chuck with no indentation in your editor & it will put proper indentation for you.