Getting started

The MERMAID R package (mermaidr) is designed to help you and collaborators efficiently access, analyze, and import coral reef monitoring data from the MERMAID platform—directly within the R environment. Whether you're working with large datasets across multiple sites, conducting advanced analyses, or integrating legacy data into your ongoing monitoring data, mermaidr streamlines your workflow.

What can you do with this R package

With mermaidr, you can:

  • Access and export your project data from MERMAID for custom analysis.

  • Compile datasets from multiple projects or survey years.

  • Import historical or legacy datasets into your MERMAID projects.

  • Validate your data against MERMAID templates before import.

  • Leverage ready-made analysis code templates from the MERMAID analysis hub.

These features make mermaidr a valuable tool for those in the MERMAID community conducting analysis, as well as those seeking a smooth path for integrating their datasets into one platform.

Software requirements

Before you begin, ensure that you have R and RStudio installed on your computer. 

Download R: https://cran.rstudio.com/

Download RStudio: https://posit.co/download/rstudio-desktop/

These programs provide the environment in which you will run the package mermaidr.

Installing mermaidr

Open RStudio. In the Console panel (bottom left by default), or in a new script file (top left), install the package mermaidr directly from GitHub:

#install package from GitHub 
install.packages("devtools") 
devtools::install_github("data-mermaid/mermaidr")
# or use the "remotes" package to install mermaidr
remotes::install_github("data-mermaid/mermaidr")

Then load the package:

#load package
library(mermaidr)

Visit the package website for detailed documentation, function references, and tutorials.  

For a full list of available functions: Function reference

Authentication and access requirements

To access projects you have access to in mermaidr, you must authenticate your session. For this, you will need a verified MERMAID account. You can sign up for free at app.datamermaid.org.

When you call a project data access function (e.g, mermaid_get_my_projects()), a browser window will automatically open prompting you to log in with your MERMAID credentials (either using Google sign-in or your username and password – however, you normally log in). Once authenticated, the package stores a temporary access token to authorize your session. Just close your browser window and return to R once authentication is completed.

Note: Authentication is valid for 24 hours. After that, you will need to log in again when running a new function. The package handles the expiration for you, so just log in again when prompted.

You can access:

  • Your own projects — all MERMAID projects that you are part of (authentication needed)

  • Public projects — projects with data sharing policies set to public or public summary (no authentication needed)

This dual access allows you to:

  • Analyze your own project’s data

  • Aggregate data from across projects, sites, or countries

  • Conduct regional comparisons

  • Perform global syntheses using open-access coral reef data

Useful resources