See the excellent notes from Jeff Leek on creating and maintaining R packages
https://github.com/jtleek/rpackages