This is an announcement of the release of an R package 'formatR', which can help us format our R code to make it more human-readable. If you have ugly (I mean unformatted) R code like this:
# rotation of the word "Animation" # in a loop; change the angle and color # step by step for (i in 1:360) { # redraw the plot again and again plot(1,ann=FALSE,type="n",axes=FALSE) # rotate; use rainbow() colors text(1,1,"Animation",srt=i,col=rainbow(360)[i],cex=7*i/360) # pause for a while Sys.sleep(0.01)} There are no spaces, no appropriate indent... The package 'formatR' provides a GUI (by gWidgets) to make messy R code clean and tidy, e.g. # rotation of the word 'Animation' # in a loop; change the angle and color # step by step for (i in 1:360) { # redraw the plot again and again plot(1, ann = FALSE, type = "n", axes = FALSE) # rotate; use rainbow() colors text(1, 1, "Animation", srt = i, col = rainbow(360)[i], cex = 7 * i/360) # pause for a while Sys.sleep(0.01) } The usage is simple: # formatR depends on RGtk+; will be installed automatically # better use the latest version of R (>=2.10.1) install.packages('formatR') library(formatR) # or formatR() Screen-shots can be found here: http://yihui.name/en/2010/04/formatr-farewell-to-ugly-r-code/ Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA _______________________________________________ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.