If you're thinking about starting a project (for example, a report or paper) using the R language for analysis, the Nice R code blog has some great advice. Following the principles of reproducible research, Macquarie University postdocs Rich FitzJohn and Daniel Falster suggest:
- Creating a directory structure to separate R code, data, reports, and output
- Treating data as read-only files: do data-munging in R code, but always start with the source data
- Consider output artifcacts (figures and tables) as disposable: the data plus the R script is the canonical source
- Separate function definitions from the workaday scripts linking them together
They also offer some great advice on setting up a project under these guidelines in RStudio. Follow the link below for complete details and other great tips for a reproducible R-based workflow.
Nice R Blog: Designing projects