Version Control

When you do any type of research project that involves data analysis, it is inevitable that you will produce many files! Without version control, I usually end up with something like:

Source: xkcd comics

Instead of abandoning all hope, there are ways to make your project folder less chaotic. For example, the British ecological society has a collection of guides to better science on their website, of which one describes reproducible code. The guide describes everything you need to get started and I highly recommend reading it. Here’s a quick overview of the recommended workflow:

Version control with Git and GitHub

If you have never heard about version control before, it’s a bit like using Google Docs to collaborate on a document: you can collaborate easily with others, you don’t have to change the name each time you save the file, and there is a history of changes. A version control system such as Git is a bit like that, but more structured and for entire folders of files.

Anyone who has wrestled with multiple versions of a document or script named by appending the word “final” will know how quickly such naming conventions can escalate into absurdity. Version control provides a structured and transparent means of tracking changes to code and other files. - A Guide to reproducible Code in Ecology and Evolution

If you want to work specifically with Git/Github and R, I recommend this incredibly useful site that will help you get started connecting the tools to each other. The setup takes a bit of patience the first time, but once everything is up and running you will not have to configure it again.