When I undertake an R project of any complexity, my scripts quickly get long and confusing.
What are some practices I can adopt so that my code will always be a pleasure to work with? I'm thinking about things like
The standard answer is to use packages -- see the Writing R Extensions manual as well as different tutorials on the web.
It gives you
R CMD check
source() over code works for really short snippets. Everything else should be in a package -- even if you do not plan to publish it as you can write internal packages for internal repositories.
Update 2008-Aug-13: David Smith just blogged about the Google R Style Guide.