11

I know that many programming languages have tools to tidy up programming code? Is there a way to tidy up R code or some tools that will do this (e.g. included in R IDE's?)?

jrara
  • 16,239
  • 33
  • 89
  • 120
  • 1
    For everyone else who thought he was using 'R' as an annoying shortcut for 'our': http://en.wikipedia.org/wiki/R_(programming_language). I have no idea, just thought I'd mention that :) – DanTheMan Jun 22 '11 at 19:12
  • 2
    Emacs + [ESS](http://ess.r-project.org/) or (I guess) [Rstudio](http://www.rstudio.org/) :-) – chl Jun 22 '11 at 21:25

2 Answers2

8

You can try formatR, which I found via this blog post.

Marek
  • 49,472
  • 15
  • 99
  • 121
DanTheMan
  • 3,277
  • 2
  • 21
  • 40
2

In RStudio, there is an option for this in the menu: Code > Reformat code. Default hotkey in Windows is Ctrl+Shift+A

Tamas Nagy
  • 1,001
  • 12
  • 22