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.
To install from CRAN, use
You can install the stable version on CRAN:
Or use the devtools package to install the development version:
library(devtools) install_github('formatR', 'yihui')