This article walks through, in detail, accessing data specific to projects, primarily via mermaid_get_project_data().

To access data related to your MERMAID projects, first obtain a list of your projects with mermaid_get_my_projects().

At this point, you will have to authenticate to the Collect app. R will help you do this automatically by opening a browser window for you to log in to Collect, either via Google sign-in or username and password - however you normally do!

Once you’ve logged in, come back to R. Your login credentials will be stored for a day, until they expire, and you will need to login again. The package handles the expiration for you, so just log in again when prompted.

library(mermaidr)
my_projects <- mermaid_get_my_projects()

my_projects
#> # A tibble: 12 × 14
#>    id      name    countries  num_sites tags      notes     status data_policy_bel…
#>    <chr>   <chr>   <chr>          <int> <chr>     <chr>     <chr>  <chr>           
#>  1 02e691… TWP Gi… Indonesia         14 "WCS Ind… ""        Open   Private         
#>  2 170e71… 2018_V… Fiji              10 "WCS Fij… "This is… Open   Private         
#>  3 2d6cee… WCS Mo… Mozambique        74 "WCS Moz… "Databas… Open   Private         
#>  4 3a9ecb… Aceh J… Indonesia         18 "Vibrant… ""        Open   Private         
#>  5 408067… Madaga… Madagascar        74 "WCS Mad… "MACMON … Open   Private         
#>  6 4d23d2… Madaga… Madagascar        16 "WCS Mad… "Monitor… Open   Public Summary  
#>  7 507d1a… Karimu… Indonesia         43 "Vibrant… ""        Open   Private         
#>  8 5679ef… Madaga… Madagascar        33 "WCS Mad… ""        Open   Public Summary  
#>  9 75ef7a… Kubula… Fiji              78 "WCS Fij… ""        Open   Private         
#> 10 9de827… XPDC K… Indonesia         37 ""        "XPDC Ke… Open   Private         
#> 11 a1b7ff… Great … Fiji              76 "Fiji Mi… ""        Open   Private         
#> 12 e1efb1… 2016_N… Fiji               8 "WCS Fij… "Namena … Open   Private         
#> # … with 6 more variables: data_policy_benthiclit <chr>,
#> #   data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> #   data_policy_bleachingqc <chr>, created_on <chr>, updated_on <chr>

This function returns information on your projects, including project countries, the number of sites, tags, data policies, and more.

To filter for specific projects, you can use the filter function from dplyr:

library(dplyr)

indonesia_projects <- my_projects %>%
  filter(countries == "Indonesia")

indonesia_projects
#> # A tibble: 4 × 14
#>   id       name    countries num_sites tags     notes       status data_policy_bel…
#>   <chr>    <chr>   <chr>         <int> <chr>    <chr>       <chr>  <chr>           
#> 1 02e6915… TWP Gi… Indonesia        14 "WCS In… ""          Open   Private         
#> 2 3a9ecb7… Aceh J… Indonesia        18 "Vibran… ""          Open   Private         
#> 3 507d1af… Karimu… Indonesia        43 "Vibran… ""          Open   Private         
#> 4 9de8278… XPDC K… Indonesia        37 ""       "XPDC Kei … Open   Private         
#> # … with 6 more variables: data_policy_benthiclit <chr>,
#> #   data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> #   data_policy_bleachingqc <chr>, created_on <chr>, updated_on <chr>

Alternatively, you can search your projects using mermaid_search_my_projects(), narrowing projects down by name, countries, or tags:

mermaid_search_my_projects(countries = "Indonesia")
#> # A tibble: 4 × 14
#>   id       name    countries num_sites tags     notes       status data_policy_bel…
#>   <chr>    <chr>   <chr>         <int> <chr>    <chr>       <chr>  <chr>           
#> 1 02e6915… TWP Gi… Indonesia        14 "WCS In… ""          Open   Private         
#> 2 3a9ecb7… Aceh J… Indonesia        18 "Vibran… ""          Open   Private         
#> 3 507d1af… Karimu… Indonesia        43 "Vibran… ""          Open   Private         
#> 4 9de8278… XPDC K… Indonesia        37 ""       "XPDC Kei … Open   Private         
#> # … with 6 more variables: data_policy_benthiclit <chr>,
#> #   data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> #   data_policy_bleachingqc <chr>, created_on <chr>, updated_on <chr>

Then, you can start to access data about your projects, like project sites via mermaid_get_project_sites():

indonesia_projects %>%
  mermaid_get_project_sites()
#> # A tibble: 112 × 13
#>    project    id       name    notes latitude longitude country reef_type reef_zone
#>    <chr>      <chr>    <chr>   <chr>    <dbl>     <dbl> <chr>   <chr>     <chr>    
#>  1 Karimunja… a7635ca… Gentin… ""       -5.86     111.  Indone… fringing  back reef
#>  2 Aceh Jaya… 5436053… Wisata… ""        5.04      95.4 Indone… fringing  fore reef
#>  3 Aceh Jaya… b7d5cf6… Rehabi… ""        4.84      95.4 Indone… fringing  fore reef
#>  4 Karimunja… 03685be… Menyaw… ""       -5.80     110.  Indone… fringing  fore reef
#>  5 Aceh Jaya… 38f75ee… Pulau … ""        5.08      95.3 Indone… fringing  back reef
#>  6 Karimunja… 21aec9f… Batu P… ""       -5.81     110.  Indone… fringing  back reef
#>  7 Karimunja… 371b3e9… Tanjun… ""       -5.83     110.  Indone… fringing  back reef
#>  8 Karimunja… 43d3d64… Legon … ""       -5.87     110.  Indone… fringing  back reef
#>  9 Karimunja… 9ec6f18… Cemara… ""       -5.80     110.  Indone… fringing  back reef
#> 10 Karimunja… e23aaba… Tanjun… ""       -5.86     110.  Indone… fringing  back reef
#> # … with 102 more rows, and 4 more variables: exposure <chr>, predecessor <chr>,
#> #   created_on <chr>, updated_on <chr>

Or the managements for your projects via mermaid_get_project_managements():

indonesia_projects %>%
  mermaid_get_project_managements()
#> # A tibble: 24 × 17
#>    project                id    name  name_secondary notes est_year no_take periodic_closure
#>    <chr>                  <chr> <chr> <chr>          <chr>    <int> <lgl>   <lgl>           
#>  1 TWP Gili Sulat Lawang  0975… Zona… "Core Zone"    ""        2013 TRUE    FALSE           
#>  2 TWP Gili Sulat Lawang  636c… Luar… "Open Access"  ""        2020 FALSE   FALSE           
#>  3 TWP Gili Sulat Lawang  bc4e… Zona… "Fisheries Ut… ""        2013 FALSE   FALSE           
#>  4 TWP Gili Sulat Lawang  f557… Zona… "Sustainable … ""        2013 FALSE   FALSE           
#>  5 Aceh Jaya Coastal Park 0f0f… Open  ""             ""        2019 FALSE   FALSE           
#>  6 Aceh Jaya Coastal Park 1498… Tour… ""             ""        2019 TRUE    FALSE           
#>  7 Aceh Jaya Coastal Park 646c… Fish… ""             ""        2019 FALSE   FALSE           
#>  8 Aceh Jaya Coastal Park a579… Aqua… ""             ""        2019 FALSE   FALSE           
#>  9 Aceh Jaya Coastal Park a803… Open… ""             ""        2019 FALSE   FALSE           
#> 10 Aceh Jaya Coastal Park cc92… Core… ""             ""        2019 TRUE    FALSE           
#> # … with 14 more rows, and 9 more variables: open_access <lgl>, size_limits <lgl>,
#> #   gear_restriction <lgl>, species_restriction <lgl>, compliance <chr>,
#> #   predecessor <lgl>, parties <chr>, created_on <chr>, updated_on <chr>

Method data

You can also access data on your projects’ Fish Belt, Benthic LIT, Benthic PIT, Bleaching, and Habitat Complexity methods. The details are in the following sections.

Fish Belt data

To access Fish Belt data for a project, use mermaid_get_project_data() with method = "fishbelt".

You can access individual observations (i.e., a record of each observation) by setting data = "observations":

xpdc <- my_projects %>%
  filter(name == "XPDC Kei Kecil 2018")

xpdc %>%
  mermaid_get_project_data(method = "fishbelt", data = "observations")
#> # A tibble: 3,069 × 65
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  9 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#> # … with 3,059 more rows, and 56 more variables: reef_slope <chr>, tide <chr>,
#> #   current <chr>, visibility <chr>, relative_depth <chr>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

You can access sample units data, which are observations aggregated to the sample units level. Fish belt sample units contain total biomass in kg/ha per sample unit, by trophic group and by fish family:

xpdc %>%
  mermaid_get_project_data("fishbelt", "sampleunits")
#> # A tibble: 246 × 79
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  9 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#> # … with 236 more rows, and 70 more variables: reef_slope <chr>, tide <chr>,
#> #   current <chr>, visibility <chr>, relative_depth <chr>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

And finally, sample events data, which are aggregated further, to the sample event level. Fish belt sample events contain mean total biomass in kg/ha per sample event, by trophic group and by fish family:

xpdc_sample_events <- xpdc %>%
  mermaid_get_project_data("fishbelt", "sampleevents")

xpdc_sample_events
#> # A tibble: 46 × 69
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE04     -5.58      132. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE05     -5.47      133. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE06     -5.52      132. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE07     -5.57      133. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE08     -5.55      133. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE09     -5.60      133. fringing  fore reef semi-exposed 
#>  9 XPDC K… NA    Indone… KE10     -5.57      133. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE11     -5.59      133. fringing  crest     exposed      
#> # … with 36 more rows, and 60 more variables: tide <chr>, current <chr>,
#> #   visibility <chr>, aca_geomorphic <chr>, aca_benthic <chr>,
#> #   andrello_grav_nc <dbl>, andrello_sediment <dbl>, andrello_nutrient <dbl>,
#> #   andrello_pop_count <dbl>, andrello_num_ports <dbl>, andrello_reef_value <dbl>,
#> #   andrello_cumul_score <dbl>, beyer_score <dbl>, beyer_scorecn <dbl>,
#> #   beyer_scorecy <dbl>, beyer_scorepfc <dbl>, beyer_scoreth <dbl>,
#> #   beyer_scoretr <dbl>, management <chr>, management_secondary <chr>, …

Benthic LIT data

To access Benthic LIT data, use mermaid_get_project_data() with method = "benthiclit".

mozambique <- my_projects %>%
  filter(name == "WCS Mozambique Coral Reef Monitoring")

mozambique %>%
  mermaid_get_project_data(method = "benthiclit", data = "observations")
#> # A tibble: 1,569 × 56
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <chr> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  2 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  3 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  4 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  5 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  6 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  7 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  8 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  9 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#> 10 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#> # … with 1,559 more rows, and 47 more variables: reef_slope <lgl>, tide <chr>,
#> #   current <lgl>, visibility <lgl>, relative_depth <lgl>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

You can access sample units and sample events the same way.

For Benthic LIT, sample units contain percent cover per sample unit, by benthic category. Sample events contain mean percent cover per sample event, by benthic category.

mozambique %>%
  mermaid_get_project_data(method = "benthiclit", data = "sampleunits")
#> # A tibble: 63 × 65
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <chr> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  2 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  3 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  4 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  5 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  6 WCS Mo… WCS … Mozamb… Barr…    -26.0      32.9 barrier   back reef sheltered    
#>  7 WCS Mo… WCS … Mozamb… Barr…    -26.1      32.9 barrier   back reef sheltered    
#>  8 WCS Mo… WCS … Mozamb… Barr…    -26.1      32.9 barrier   back reef sheltered    
#>  9 WCS Mo… WCS … Mozamb… Barr…    -26.1      32.9 barrier   back reef sheltered    
#> 10 WCS Mo… WCS … Mozamb… Barr…    -26.1      32.9 barrier   back reef sheltered    
#> # … with 53 more rows, and 56 more variables: reef_slope <lgl>, tide <chr>,
#> #   current <lgl>, visibility <lgl>, relative_depth <lgl>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

Benthic PIT data

To access Benthic LIT data, change method to “benthicpit”:

xpdc %>%
  mermaid_get_project_data(method = "benthicpit", data = "observations")
#> # A tibble: 11,100 × 57
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  9 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#> # … with 11,090 more rows, and 48 more variables: reef_slope <chr>, tide <chr>,
#> #   current <chr>, visibility <chr>, relative_depth <chr>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

You can access sample units and sample events the same way, and the data format is the same as Benthic LIT.

You can return both sample units and sample events by setting the data argument. This will return a list of two data frames: one containing sample units, and the other sample events.

xpdc_sample_units_events <- xpdc %>%
  mermaid_get_project_data(method = "benthicpit", data = c("sampleunits", "sampleevents"))

names(xpdc_sample_units_events)
#> [1] "sampleunits"  "sampleevents"
xpdc_sample_units_events[["sampleunits"]]
#> # A tibble: 111 × 66
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE04     -5.58      132. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE04     -5.58      132. fringing  crest     exposed      
#>  9 XPDC K… NA    Indone… KE04     -5.58      132. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE05     -5.47      133. fringing  crest     exposed      
#> # … with 101 more rows, and 57 more variables: reef_slope <chr>, tide <chr>,
#> #   current <chr>, visibility <chr>, relative_depth <chr>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, …

Bleaching

To access Bleaching data, set method to “bleaching”. There are two types of observations data for the Bleaching method: Colonies Bleached and Percent Cover. These are both returned when pulling observations data, in a list:

bleaching_obs <- mozambique %>%
  mermaid_get_project_data("bleaching", "observations")

names(bleaching_obs)
#> [1] "colonies_bleached" "percent_cover"

bleaching_obs[["colonies_bleached"]]
#> # A tibble: 1,814 × 57
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <chr> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  2 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  3 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  4 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  5 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  6 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  7 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  8 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  9 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#> 10 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#> # … with 1,804 more rows, and 48 more variables: tide <lgl>, current <lgl>,
#> #   visibility <lgl>, relative_depth <lgl>, aca_geomorphic <chr>,
#> #   aca_benthic <chr>, andrello_grav_nc <dbl>, andrello_sediment <dbl>,
#> #   andrello_nutrient <dbl>, andrello_pop_count <dbl>, andrello_num_ports <dbl>,
#> #   andrello_reef_value <dbl>, andrello_cumul_score <dbl>, beyer_score <dbl>,
#> #   beyer_scorecn <dbl>, beyer_scorecy <dbl>, beyer_scorepfc <dbl>,
#> #   beyer_scoreth <dbl>, beyer_scoretr <dbl>, management <chr>, …

The sample units and sample events data contain summaries of both Colonies Bleached and Percent Cover:

mozambique %>%
  mermaid_get_project_data("bleaching", "sampleevents")
#> # A tibble: 62 × 54
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <chr> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 WCS Mo… WCS … Mozamb… Aqua…    -21.8      35.5 barrier   back reef semi-exposed 
#>  2 WCS Mo… WCS … Mozamb… Baby…    -11.0      40.7 fringing  fore reef exposed      
#>  3 WCS Mo… WCS … Mozamb… Balu…    -22.0      35.5 patch     fore reef exposed      
#>  4 WCS Mo… WCS … Mozamb… Dos …    -12.1      40.6 lagoon    back reef sheltered    
#>  5 WCS Mo… WCS … Mozamb… Fing…    -12.9      40.6 fringing  fore reef exposed      
#>  6 WCS Mo… WCS … Mozamb… Kisi…    -11.0      40.7 lagoon    back reef sheltered    
#>  7 WCS Mo… WCS … Mozamb… Kisi…    -11.0      40.7 lagoon    back reef sheltered    
#>  8 WCS Mo… WCS … Mozamb… Kisi…    -11.0      40.7 lagoon    back reef sheltered    
#>  9 WCS Mo… WCS … Mozamb… Libe…    -14.5      40.7 fringing  back reef sheltered    
#> 10 WCS Mo… WCS … Mozamb… Ligh…    -12.3      40.6 fringing  fore reef exposed      
#> # … with 52 more rows, and 45 more variables: tide <lgl>, current <lgl>,
#> #   visibility <lgl>, aca_geomorphic <chr>, aca_benthic <chr>,
#> #   andrello_grav_nc <dbl>, andrello_sediment <dbl>, andrello_nutrient <dbl>,
#> #   andrello_pop_count <dbl>, andrello_num_ports <dbl>, andrello_reef_value <dbl>,
#> #   andrello_cumul_score <dbl>, beyer_score <dbl>, beyer_scorecn <dbl>,
#> #   beyer_scorecy <dbl>, beyer_scorepfc <dbl>, beyer_scoreth <dbl>,
#> #   beyer_scoretr <dbl>, management <chr>, management_secondary <chr>, …

Habitat Complexity

Finally, to access Habitat Complexity data, set method to “habitatcomplexity”. As with all other methods, you can access observations, sample units, and sample events:

xpdc %>%
  mermaid_get_project_data("habitatcomplexity", "sampleevents")
#> # A tibble: 2 × 45
#>   project  tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>   <chr>    <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#> 1 XPDC Ke… NA    Indone… KE22     -5.85      133. fringing  fore reef exposed      
#> 2 XPDC Ke… NA    Indone… KE24     -5.93      133. fringing  fore reef exposed      
#> # … with 36 more variables: tide <chr>, current <chr>, visibility <chr>,
#> #   aca_geomorphic <chr>, aca_benthic <chr>, andrello_grav_nc <dbl>,
#> #   andrello_sediment <dbl>, andrello_nutrient <dbl>, andrello_pop_count <dbl>,
#> #   andrello_num_ports <dbl>, andrello_reef_value <dbl>,
#> #   andrello_cumul_score <dbl>, beyer_score <dbl>, beyer_scorecn <dbl>,
#> #   beyer_scorecy <dbl>, beyer_scorepfc <dbl>, beyer_scoreth <dbl>,
#> #   beyer_scoretr <dbl>, management <chr>, management_secondary <chr>, …

Multiple methods data

To pull data for both fish belt and benthic PIT methods, you can set method to include both.

xpdc_sample_events <- xpdc %>%
  mermaid_get_project_data(method = c("fishbelt", "benthicpit"), data = "sampleevents")

The result is a list of data frames, containing sample events for both fish belt and benthic PIT methods:

names(xpdc_sample_events)
#> [1] "fishbelt"   "benthicpit"

xpdc_sample_events[["benthicpit"]]
#> # A tibble: 38 × 56
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <lgl> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 XPDC K… NA    Indone… KE02     -5.44      133. fringing  crest     exposed      
#>  2 XPDC K… NA    Indone… KE03     -5.61      132. fringing  crest     exposed      
#>  3 XPDC K… NA    Indone… KE04     -5.58      132. fringing  crest     exposed      
#>  4 XPDC K… NA    Indone… KE05     -5.47      133. fringing  crest     exposed      
#>  5 XPDC K… NA    Indone… KE06     -5.52      132. fringing  crest     exposed      
#>  6 XPDC K… NA    Indone… KE07     -5.57      133. fringing  crest     exposed      
#>  7 XPDC K… NA    Indone… KE08     -5.55      133. fringing  crest     exposed      
#>  8 XPDC K… NA    Indone… KE09     -5.60      133. fringing  fore reef semi-exposed 
#>  9 XPDC K… NA    Indone… KE10     -5.57      133. fringing  crest     exposed      
#> 10 XPDC K… NA    Indone… KE11     -5.59      133. fringing  crest     exposed      
#> # … with 28 more rows, and 47 more variables: tide <chr>, current <chr>,
#> #   visibility <chr>, aca_geomorphic <chr>, aca_benthic <chr>,
#> #   andrello_grav_nc <dbl>, andrello_sediment <dbl>, andrello_nutrient <dbl>,
#> #   andrello_pop_count <dbl>, andrello_num_ports <dbl>, andrello_reef_value <dbl>,
#> #   andrello_cumul_score <dbl>, beyer_score <dbl>, beyer_scorecn <dbl>,
#> #   beyer_scorecy <dbl>, beyer_scorepfc <dbl>, beyer_scoreth <dbl>,
#> #   beyer_scoretr <dbl>, management <chr>, management_secondary <chr>, …

Alternatively, you can set method to “all” to pull for all methods! Similarly, you can set data to “all” to pull all types of data:

all_project_data <- xpdc %>%
  mermaid_get_project_data(method = "all", data = "all", limit = 1)

names(all_project_data)
#> [1] "fishbelt"          "benthiclit"        "benthicpit"        "bleaching"        
#> [5] "habitatcomplexity"

names(all_project_data[["benthicpit"]])
#> [1] "observations" "sampleunits"  "sampleevents"

Multiple projects

Pulling data for multiple projects is the exact same, except there will be an additional “project” column at the beginning to distinguish which projects the data comes from. Recall that my_projects contains six projects:

my_projects
#> # A tibble: 12 × 14
#>    id      name    countries  num_sites tags      notes     status data_policy_bel…
#>    <chr>   <chr>   <chr>          <int> <chr>     <chr>     <chr>  <chr>           
#>  1 02e691… TWP Gi… Indonesia         14 "WCS Ind… ""        Open   Private         
#>  2 170e71… 2018_V… Fiji              10 "WCS Fij… "This is… Open   Private         
#>  3 2d6cee… WCS Mo… Mozambique        74 "WCS Moz… "Databas… Open   Private         
#>  4 3a9ecb… Aceh J… Indonesia         18 "Vibrant… ""        Open   Private         
#>  5 408067… Madaga… Madagascar        74 "WCS Mad… "MACMON … Open   Private         
#>  6 4d23d2… Madaga… Madagascar        16 "WCS Mad… "Monitor… Open   Public Summary  
#>  7 507d1a… Karimu… Indonesia         43 "Vibrant… ""        Open   Private         
#>  8 5679ef… Madaga… Madagascar        33 "WCS Mad… ""        Open   Public Summary  
#>  9 75ef7a… Kubula… Fiji              78 "WCS Fij… ""        Open   Private         
#> 10 9de827… XPDC K… Indonesia         37 ""        "XPDC Ke… Open   Private         
#> 11 a1b7ff… Great … Fiji              76 "Fiji Mi… ""        Open   Private         
#> 12 e1efb1… 2016_N… Fiji               8 "WCS Fij… "Namena … Open   Private         
#> # … with 6 more variables: data_policy_benthiclit <chr>,
#> #   data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> #   data_policy_bleachingqc <chr>, created_on <chr>, updated_on <chr>
my_projects %>%
  mermaid_get_project_data("fishbelt", "sampleevents", limit = 1)
#> # A tibble: 11 × 82
#>    project tags  country site  latitude longitude reef_type reef_zone reef_exposure
#>    <chr>   <chr> <chr>   <chr>    <dbl>     <dbl> <chr>     <chr>     <chr>        
#>  1 TWP Gi… WCS … Indone… Peda…    -8.28     117.  fringing  crest     exposed      
#>  2 2018_V… WCS … Fiji    VIR1    -17.3      178.  barrier   fore reef exposed      
#>  3 WCS Mo… WCS … Mozamb… Aqua…   -21.8       35.5 barrier   back reef semi-exposed 
#>  4 Aceh J… WCS … Indone… Abah…     4.99      95.4 fringing  fore reef exposed      
#>  5 Madaga… WCS … Madaga… Kisi…   -13.6       48.1 fringing  fore reef exposed      
#>  6 Karimu… WCS … Indone… Batu…    -5.81     110.  fringing  back reef semi-exposed 
#>  7 Madaga… WCS … Madaga… Anta…   -16.4       49.8 fringing  fore reef semi-exposed 
#>  8 Kubula… WCS … Fiji    C13     -17.0      179.  barrier   fore reef semi-exposed 
#>  9 XPDC K… <NA>  Indone… KE02     -5.44     133.  fringing  crest     exposed      
#> 10 Great … Fiji… Fiji    BA02    -17.4      178.  atoll     back reef very shelter…
#> 11 2016_N… WCS … Fiji    C3      -17.1      179.  barrier   fore reef exposed      
#> # … with 73 more variables: tide <chr>, current <chr>, visibility <chr>,
#> #   aca_geomorphic <chr>, aca_benthic <chr>, andrello_grav_nc <dbl>,
#> #   andrello_sediment <dbl>, andrello_nutrient <dbl>, andrello_pop_count <dbl>,
#> #   andrello_num_ports <dbl>, andrello_reef_value <dbl>,
#> #   andrello_cumul_score <dbl>, beyer_score <dbl>, beyer_scorecn <dbl>,
#> #   beyer_scorecy <dbl>, beyer_scorepfc <dbl>, beyer_scoreth <dbl>,
#> #   beyer_scoretr <dbl>, management <chr>, management_secondary <chr>, …

Note the limit argument here, which just limits the data pulled to one record (per project, method, and data combination). This is useful if you want to get a preview of what your data will look like without having to pull it all in.