Accessing your project data from MERMAID using mermaidr is an easy four-step process.
Step 1: Retrieving Your Projects
To retrieve your projects, use the mermaid_get_my_projects()
function.
#load your projects - starts authentication if needed
my_projects <- mermaid_get_my_projects()
When this function is run:
A browser window will open (if it is your first time using mermaidr or have not been using it for the last 24 hours)
Enter your MERMAID credentials
You’ll receive a confirmation message: Authentication complete. Please close this page and return to R.
Return to RStudio and your session will be authenticated
This will retrieve all projects that you are part of either as an Admin, Collector or Read-Only user.
By default, all your test projects are not included when running this mermaid_get_my_projects()
function.
If you want to also retrieve your test projects, run this function instead:
#load your projects, including test projects
my_projects <- mermaid_get_my_projects(include_test_projects = TRUE)
This will retrieve all projects, including test projects that you are part of.
Step 2: Viewing Your Projects
Once loaded, you can view your projects in a table using:
#view your projects as a table
View(my_projects)
#or print your projects in your console
print(my_projects)
This will open a table showing a list with:
Project IDs and names
Countries
Number of sites
Organization tags
Notes
Data sharing policies
Creation/update dates
Step 3: Filtering Your Projects
You can filter or group your projects (my_projects
object) using the filter function in the package dplyr.
#install dplyr package if you need to
install.package(dplyr)
#load dplyr package
library(dplyr)
#filter projects by country
indonesia_projects <- my_projects %>%
filter(countries == "Indonesia")
You can filter by:
Country
Project name or ID
Year
Survey method (e.g., Fish Belt, Benthic PIT)
Organization tags
Alternatively, use mermaid_search_my_projects()
to search more directly:
#search your projects by country
indonesia_projects <- mermaid_search_my_projects(countries = "Indonesia")
You can also combine queries to narrow down your search:
#search your projects by country and organization tag
WCS_indonesia_projects <- mermaid_search_my_projects(countries = "Indonesia", tags = "WCS Indonesia")
This makes it easy to compile datasets for multi-site or regional analyses.
Step 4: Getting Data from Projects
Once you have your filtered list of projects, you can retrieve their data using:
#get fish belt observation data for filtered projects
indonesia_projects %>%
mermaid_get_project_data(method = "fishbelt", data = "observations")
This command will display all raw observations for the specified method–in this example Fish Belt– across your filtered projects. You can specify one or multiple survey methods, and retrieve data for various levels of aggregation.
You can specify the following survey methods:
“fishbelt”
= Fish Belt“benthicpit”
= Benthic PIT“benthiclit”
= Benthic LIT“benthicpqt”
= Benthic Photo Quadrat“bleaching”
= Bleaching“habitatcomplexity”
= Habitat Complexity
And choose the level of aggregation:
"observations"
= Raw observations"sampleunits"
= Sample unit-level averages"sampleevents"
= Sample event-level summaries
To combine different methods and levels of data aggregation:
#get fish belt and benthic pit data for filtered projects at sample unit and sample event levels
indonesia_projects %>%
mermaid_get_project_data(method = c("fishbelt", "benthicpit"), data = c( "sampleunits", "sampleevents")
This will display all combined data for the methods specified–in this example Fish Belt and Benthic PIT– averaged at the sample unit-level and sample event-level.
Learn more about how to access your projects data in our GitHub documentation: Accessing project data
Access Publicly Available Data in MERMAID
In addition to your own projects, you can access and analyze summary data at the sample event-level from all projects that have been made publicly available in MERMAID by other users.
This doesn’t require authentication.
Use the following functions to retrieve public projects and get sample event-level data directly in R:
#retrieve all publicly available projects in MERMAID
all_projects <- mermaid_get_projects() #you can also apply filters here
all_projects <- mermaid_search_projects()
#get sample event data for all publicly available projects
all_projects_summary_data <-mermaid_get_summary_sampleevents(limit = NULL) #you can also apply filters here
You can also apply filters here following the same procedures as in Steps 3 and 4.
Start Your Analysis
Once you’ve accessed your data in MERMAID, you can begin your analysis.
To get a quick start, use the ready-made analysis templates available in the MERMAID analysis hub.