Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tidy up R code?

Tags:

r

ide

tidy

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?)?

like image 565
jrara Avatar asked Jun 22 '11 19:06

jrara


2 Answers

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

like image 173
DanTheMan Avatar answered Oct 04 '22 19:10

DanTheMan


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

like image 45
Tamas Nagy Avatar answered Oct 04 '22 21:10

Tamas Nagy