Reproducibility, R and data

The word of the day is Reproducibility. For as long as I have been using R I have been manually copying and pasting R codes, output and graphs into word documents. Too long, too troublesome. That’s when I discovered RMarkdown, an implementation of Markdown in R, which allows you to create documents with formatting similar to that seen in LaTeX and embedded R code and output all in one handy place. Needless to say I have been extremely distracted and excited about analysing my data with this new workflow. R scripts aren’t good enough on their own anymore but full LaTeX does not suit my needs.

The most recent update of RStudio includes a slight extension of this: RNotebook which will allow you to preview the final document without having to generate the complete document every time (which can take a while). I am excited by this update, for example it will run multi-line code automatically, but so far I have found the update to be a bit laggy and cumbersome. The console stubbornly refuses to switch to another pane and the automatic display of output within the script can make the screen messy.

At the same time I have been using the opportunity to get into the habit of not relying on base functions, especially for plotting. I have been playing with ggplot2 and the colour palette package viridis, which I highly recommend.

I have spent most of the year, indeed most of my PhD, collecting data. Another useful tool we have established is a MySQL database implemented in R through RMySQL. It’s a steep learning curve if you are not familiar with relational databases and SQL syntax but it is great when you have lots of independently collected data that you want to collate and analyse together in various ways.

Conference season is coming up so it is time to sit down and look at all this data I have been collecting and neglecting to analyse through the year. I am looking forward to attend the Australian Entomology Society Conference in Melbourne, and I will be presenting at the Australian and New Zealand Society for Compararive Physiology and Biochemistry held at Western Sydney University.

Leave a comment