You already provide some hints by stating your approach is 'hack quick scripts'. If you want best practices and structure, simple follow the established best practices from CRAN:
- create a package, this opens the door to running
R CMD check which is very useful
- as many people have stated, having a package helps you in the code writing stage too as you are somewhat forced to document the code; that is a Good Thing (TM)
- once you have a package, add code in the
\examples{} section of the documentation as this will be running during R CMD check and provides an easy entry to regression testing
- once you get used to regression testing, start to use a package such as RUnit; that really is best practices
- JD's pointer to the Google Style Guide is a good one too. That isn't the only style guide as e.g. Henrik's R Coding Convention precedes it by a few years; and there is also Hadley's riff on Google's style guide
- Otherwise, the oldie-but-goldie 'do what your colleagues and coauthors do' also applies