How to indent multiple lines of code in Rstudio?

WetlabStudent picture WetlabStudent · Jun 12, 2013 · Viewed 34.5k times · Source

I have tried using "reindent lines" after highlighting the lines but that doesn't work (in fact it removes indentation). For example I want a quick way to

take a script like this

#parameters
b=2
c=1
d=4
q=3

and turn it into this

#parameters
    b=2
    c=1
    d=4
    q=3

in Rstudio

Answer

Dason picture Dason · Jun 12, 2013

Highlighting the code of interest and hitting tab should add another level of indentation. Shift-tab will remove a level of indentation.