Data and code tutorial

Code

Below are some simple steps to get your lab projects up and running. The instructions assume you are using RStudio and have git installed on your computer. If you have an existing project, start at the second section.

Creating a new project from scratch

Starting a RStudio project from an existing project

Organizing a project

Folder Purpose Why it’s special
data For raw data only It is read only! Never save or manipulate anything in this folder
R For R code that is sourced from the main analysis.R script Reduced clutter in the main analysis script
output For saving anything produced by the analysis script (e.g., tables, cleaned datasets, figures, etc.) The folder can be deleted and regenerated by the analysis script
figs This is also an output folder, but is often easier to keep separate. For saving figures only The folder can be deleted and regenerated by the analysis script
doc This is for manuscripts and presentations, and typically isn’t versioned controlled by adding doc to the .gitignore A general folder for stuff

Versioning a project

.Rproj.user
.Rhistory
.RData
.Ruserdata
.DS_Store

/doc
/data/images

Adding project to GitHub

Datasets

Most datasets are small enough to be published with the GitHub project (above). Some journals require that data are submitted to online data repositories so they have a DOI, in which case follow the journal’s instructions. Zenodo and FigShare are easy-to-use, free options.

Please also add your data set to the lab’s dataset registry: [Add dataset]