R Markdown + R + RStudio



Rmarkdown is a file format that allows you to create dynamic documents with text and embedded chunks of R code. The embedded code will run and display output, as well as nicely formatted graphics, equations, tables, and the like. Using Rmarkdown streamlines and integrates analysis and report generation. If underlying data or methods of analysis change, the report and embedded plots, graphics and numbers will be automatically updated. This saves time, and reduces potential for error. Since the files can be converted to HTML, Rmarkdown is also great for creating documents to share online. In fact, this website was created using Rmarkdown and GitHub (see this tutorial by Julie Lowndes to learn more)! Creating these types of documents is a key part of our collaborative, transparent workflow.

Photo by Helloquence on Unsplash


With a few exceptions, the Ocean Health Index models and data-wrangling routines are all written in R, an open source, statistical programming language and the lingua franca of data science. There were many reasons for choosing R for the project, which are elaborated on in the linked article. In addition to its prevalence and popularity, R has a thriving, energetic community of users which means there are many online resources, and it is rapidly evolving and improving. It is also capable of producing stunning visualizations.


Many different R packages exist for different types of calculations and analysis. The figure below illustrates a general workflow with some associated packages commonly used for each stage. These stages are articulated in R for Data Science by Garrett Grolemund and Hadley Wickham, one example of the many valuable but freely available, online resources for R.




With R and Rmarkdown, we use the integrated development environment (IDE) RStudio. RStudio, or any IDE, makes programming, testing, troubleshooting, and visualizing more convenient and manageable. Whether writing functions, scripts, markdown documents, or creating shiny apps or packages, RStudio helps one manage projects that keep objects organized and environments tidy, and allows one to fluidly alternate between writing, testing, and troubleshooting. For information on how to get started with R, Rmarkdown, or RStudio, see our “Helpful Resources” page.


Photo by Johnny Chen on Unsplash