This package can be used to reformat R code: spaces and indent will be added to R code automatically, so that the code will be more human-readable and tidy. This package also provides a GUI (by gWidgets) to format R source code.
Installation
To install from CRAN, use
You can install the stable version on CRAN:
install.packages('formatR')
Or use the devtools package to install the development version:
library(devtools)
install_github('formatR', 'yihui')
Documentation and Examples
The workhorse in this package is the function tidy.source(). See the Wiki for usage and the PDF vignette for some examples.