vignettes/articles/accessing_project_data.Rmd
accessing_project_data.RmdThis 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: 16 × 21
#> id name countries num_sites num_active_sample_un…¹ num_sample_units tags
#> <chr> <chr> <chr> <int> <int> <dbl> <chr>
#> 1 e1efb1e0-… 2016… Fiji 9 10 80 WCS …
#> 2 170e7182-… 2018… Fiji 10 5 121 WCS …
#> 3 d065cba4-… 2019… Fiji 31 3 32 WCS …
#> 4 1fbdb9ea-… a2 Canada; … 9 9 0 WWF-…
#> 5 3a9ecb7c-… Aceh… Indonesia 18 54 199 WCS …
#> 6 bacd3529-… Beli… Belize; … 39 136 260 WCS …
#> 7 a1b7ff1f-… Grea… Fiji 76 8 648 Fiji…
#> 8 507d1af9-… Kari… Indonesia 43 18 842 WCS …
#> 9 75ef7a5a-… Kubu… Fiji 78 1 1145 WCS …
#> 10 5679ef3d-… Mada… Madagasc… 33 0 49 WCS …
#> 11 4080679f-… Mada… Madagasc… 74 4 84 WCS …
#> 12 4d79339f-… MERM… Indonesi… 13 73 31 test…
#> 13 2c0c9857-… Shar… Canada; … 28 61 7 <NA>
#> 14 02e6915c-… TWP … Indonesia 14 10 2 WCS …
#> 15 2d6cee25-… WCS … Mozambiq… 74 6 247 WCS …
#> 16 9de82789-… XPDC… Indonesia 37 71 450 <NA>
#> # ℹ abbreviated name: ¹num_active_sample_units
#> # ℹ 14 more variables: suggested_citation <chr>, bbox <df[,4]>, notes <chr>,
#> # status <chr>, data_policy_beltfish <chr>, data_policy_benthiclit <chr>,
#> # data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> # data_policy_bleachingqc <chr>, data_policy_benthicpqt <chr>,
#> # data_policy_macroinvertebrate <chr>, includes_gfcr <lgl>, 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 × 21
#> id name countries num_sites num_active_sample_un…¹ num_sample_units tags
#> <chr> <chr> <chr> <int> <int> <dbl> <chr>
#> 1 3a9ecb7c-f… Aceh… Indonesia 18 54 199 WCS …
#> 2 507d1af9-e… Kari… Indonesia 43 18 842 WCS …
#> 3 02e6915c-1… TWP … Indonesia 14 10 2 WCS …
#> 4 9de82789-c… XPDC… Indonesia 37 71 450 <NA>
#> # ℹ abbreviated name: ¹num_active_sample_units
#> # ℹ 14 more variables: suggested_citation <chr>, bbox <df[,4]>, notes <chr>,
#> # status <chr>, data_policy_beltfish <chr>, data_policy_benthiclit <chr>,
#> # data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> # data_policy_bleachingqc <chr>, data_policy_benthicpqt <chr>,
#> # data_policy_macroinvertebrate <chr>, includes_gfcr <lgl>, 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: 7 × 21
#> id name countries num_sites num_active_sample_un…¹ num_sample_units tags
#> <chr> <chr> <chr> <int> <int> <dbl> <chr>
#> 1 3a9ecb7c-f… Aceh… Indonesia 18 54 199 WCS …
#> 2 bacd3529-e… Beli… Belize; … 39 136 260 WCS …
#> 3 507d1af9-e… Kari… Indonesia 43 18 842 WCS …
#> 4 4d79339f-2… MERM… Indonesi… 13 73 31 test…
#> 5 2c0c9857-b… Shar… Canada; … 28 61 7 <NA>
#> 6 02e6915c-1… TWP … Indonesia 14 10 2 WCS …
#> 7 9de82789-c… XPDC… Indonesia 37 71 450 <NA>
#> # ℹ abbreviated name: ¹num_active_sample_units
#> # ℹ 14 more variables: suggested_citation <chr>, bbox <df[,4]>, notes <chr>,
#> # status <chr>, data_policy_beltfish <chr>, data_policy_benthiclit <chr>,
#> # data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> # data_policy_bleachingqc <chr>, data_policy_benthicpqt <chr>,
#> # data_policy_macroinvertebrate <chr>, includes_gfcr <lgl>, 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 × 12
#> project id name latitude longitude notes country reef_type reef_zone exposure
#> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 Karimun… a763… Gent… -5.86 111. <NA> Indone… fringing back reef shelter…
#> 2 Aceh Ja… b7d5… Reha… 4.84 95.4 <NA> Indone… fringing fore reef shelter…
#> 3 Aceh Ja… 5436… Wisa… 5.04 95.4 <NA> Indone… fringing fore reef shelter…
#> 4 Karimun… 0368… Meny… -5.80 110. <NA> Indone… fringing fore reef shelter…
#> 5 Aceh Ja… 38f7… Pula… 5.08 95.3 <NA> Indone… fringing back reef semi-ex…
#> 6 Karimun… 21ae… Batu… -5.81 110. <NA> Indone… fringing back reef semi-ex…
#> 7 Karimun… f30c… Cema… -5.81 110. <NA> Indone… fringing back reef semi-ex…
#> 8 Karimun… 9ec6… Cema… -5.80 110. <NA> Indone… fringing back reef semi-ex…
#> 9 Karimun… 43d3… Lego… -5.87 110. <NA> Indone… fringing back reef semi-ex…
#> 10 Karimun… f096… Lego… -5.86 110. <NA> Indone… fringing back reef semi-ex…
#> # ℹ 102 more rows
#> # ℹ 2 more variables: 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 × 19
#> project id name size name_secondary est_year notes no_take periodic_closure
#> <chr> <chr> <chr> <dbl> <chr> <int> <chr> <lgl> <lgl>
#> 1 Aceh Jay… cc92… Core… NA <NA> 2019 <NA> TRUE FALSE
#> 2 TWP Gili… 0975… Zona… NA Core Zone 2013 <NA> TRUE FALSE
#> 3 Aceh Jay… a579… Aqua… NA <NA> 2019 <NA> FALSE FALSE
#> 4 Aceh Jay… 646c… Fish… NA <NA> 2019 <NA> FALSE FALSE
#> 5 Aceh Jay… dce8… Reha… NA <NA> 2019 <NA> TRUE FALSE
#> 6 Aceh Jay… 1498… Tour… NA <NA> 2019 <NA> TRUE FALSE
#> 7 Karimunj… 8b90… Fish… 0 <NA> 2005 <NA> FALSE FALSE
#> 8 Karimunj… bd73… Reha… NA <NA> 2005 <NA> TRUE FALSE
#> 9 Karimunj… a7e2… Tour… NA <NA> 2005 <NA> TRUE FALSE
#> 10 Aceh Jay… 0f0f… Open NA <NA> 2019 <NA> FALSE FALSE
#> # ℹ 14 more rows
#> # ℹ 10 more variables: open_access <lgl>, size_limits <lgl>, gear_restriction <lgl>,
#> # species_restriction <lgl>, access_restriction <lgl>, compliance <chr>,
#> # parties <chr>, rules <chr>, created_on <chr>, updated_on <chr>You can also access data on your projects’ Fish Belt, Benthic LIT, Benthic PIT, Macroinvertebrate, Bleaching, and Habitat Complexity methods. The details are in the following sections.
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 × 55
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 2 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 3 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 4 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 5 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 6 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 7 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 8 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 9 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 10 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> # ℹ 3,059 more rows
#> # ℹ 47 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <chr>,
#> # current <chr>, depth <dbl>, relative_depth <chr>, management <chr>,
#> # management_secondary <chr>, management_est_year <lgl>, management_size <lgl>,
#> # management_parties <lgl>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <lgl>, …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 × 67
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE18 -5.70 133.
#> 2 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE24 -5.93 133.
#> 3 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE36 -5.88 133.
#> 4 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE03 -5.61 132.
#> 5 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE15 -5.62 133.
#> 6 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE36 -5.88 133.
#> 7 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE35 -5.83 133.
#> 8 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE06 -5.52 132.
#> 9 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE31 -5.78 133.
#> 10 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE33 -5.82 133.
#> # ℹ 236 more rows
#> # ℹ 59 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <chr>, tide <chr>, visibility <chr>, current <chr>,
#> # depth <dbl>, relative_depth <chr>, management <chr>, management_secondary <chr>,
#> # management_est_year <lgl>, management_size <lgl>, management_parties <lgl>,
#> # management_compliance <chr>, management_rules <chr>, sample_date <date>,
#> # transect_number <dbl>, label <lgl>, …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, as well as standard deviations:
xpdc_sample_events <- xpdc %>%
mermaid_get_project_data("fishbelt", "sampleevents")
xpdc_sample_events
#> # A tibble: 46 × 82
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 15ed4d… XPDC K… Amkieltiela A… Indone… https://dat… NA KE02 -5.44 133.
#> 2 eda605… XPDC K… Amkieltiela A… Indone… https://dat… NA KE36 -5.88 133.
#> 3 52ae59… XPDC K… Amkieltiela A… Indone… https://dat… NA KE36 -5.88 133.
#> 4 210144… XPDC K… Amkieltiela A… Indone… https://dat… NA KE06 -5.52 132.
#> 5 3cc8e1… XPDC K… Amkieltiela A… Indone… https://dat… NA KE23 -5.80 133.
#> 6 a009b4… XPDC K… Amkieltiela A… Indone… https://dat… NA KE18 -5.70 133.
#> 7 05a34e… XPDC K… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 8 b88113… XPDC K… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 9 40afd0… XPDC K… Amkieltiela A… Indone… https://dat… NA KE19 -5.73 133.
#> 10 06ae70… XPDC K… Amkieltiela A… Indone… https://dat… NA KE31 -5.78 133.
#> # ℹ 36 more rows
#> # ℹ 73 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <chr>, current <chr>, depth_avg <dbl>, depth_sd <dbl>,
#> # management <chr>, management_secondary <chr>, management_est_year <lgl>,
#> # management_size <lgl>, management_parties <lgl>, management_compliance <chr>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, biomass_kgha_avg <dbl>, biomass_kgha_sd <dbl>, …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,574 × 48
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 2 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 3 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 4 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 5 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 6 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 7 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 8 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 9 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 10 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> # ℹ 1,564 more rows
#> # ℹ 40 more variables: reef_exposure <chr>, reef_slope <lgl>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <lgl>,
#> # current <lgl>, depth <dbl>, relative_depth <lgl>, management <chr>,
#> # management_secondary <lgl>, management_est_year <dbl>, management_size <lgl>,
#> # management_parties <chr>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <lgl>, …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.
mozambique %>%
mermaid_get_project_data(method = "benthiclit", data = "sampleunits")
#> # A tibble: 64 × 56
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pont… -26.1 33.0
#> 2 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 3 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Ligh… -11.0 40.7
#> 4 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 5 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pont… -26.1 33.0
#> 6 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pont… -26.1 33.0
#> 7 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.1 32.9
#> 8 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 9 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 10 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> # ℹ 54 more rows
#> # ℹ 48 more variables: reef_exposure <chr>, reef_slope <lgl>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <lgl>,
#> # current <lgl>, depth <dbl>, relative_depth <lgl>, management <chr>,
#> # management_secondary <lgl>, management_est_year <dbl>, management_size <lgl>,
#> # management_parties <chr>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <lgl>, …Sample events contain mean percent cover per sample event, by benthic category, and standard deviations for these values:
mozambique %>%
mermaid_get_project_data(method = "benthiclit", data = "sampleevents")
#> # A tibble: 12 × 66
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 de6b40… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Kisi… -11.0 40.7
#> 2 3e664a… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 3 157e2a… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.0 32.9
#> 4 b95a34… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pemb… -13.0 40.6
#> 5 ef54b9… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Ligh… -11.0 40.7
#> 6 18f8d0… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 7 643eb4… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pont… -26.1 33.0
#> 8 84e364… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 9 62e25c… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Lond… -12.9 40.5
#> 10 9f0527… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 11 bc3de1… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Barr… -26.1 32.9
#> 12 2574c2… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Bunt… -12.6 40.6
#> # ℹ 57 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <lgl>, current <lgl>, depth_avg <dbl>, depth_sd <dbl>,
#> # management <chr>, management_secondary <lgl>, management_est_year <dbl>,
#> # management_size <lgl>, management_parties <chr>, management_compliance <chr>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, site_notes <chr>, management_notes <lgl>, …To access Benthic PIT data, change method to
“benthicpit”:
xpdc %>%
mermaid_get_project_data(method = "benthicpit", data = "observations")
#> # A tibble: 11,100 × 49
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE26 -5.70 133.
#> 2 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 3 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 4 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 5 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 6 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 7 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 8 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 9 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 10 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> # ℹ 11,090 more rows
#> # ℹ 41 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <chr>,
#> # current <chr>, depth <dbl>, relative_depth <chr>, management <chr>,
#> # management_secondary <chr>, management_est_year <lgl>, management_size <lgl>,
#> # management_parties <lgl>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <lgl>, …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 × 57
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE09 -5.60 133.
#> 2 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE28 -5.75 133.
#> 3 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE34 -5.85 133.
#> 4 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE39 -5.99 132.
#> 5 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE05 -5.47 133.
#> 6 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE09 -5.60 133.
#> 7 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE21 -5.74 133.
#> 8 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE19 -5.73 133.
#> 9 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 10 XPDC Kei Kecil… Amkieltiela A… Indone… https://dat… NA KE31 -5.78 133.
#> # ℹ 101 more rows
#> # ℹ 49 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <chr>,
#> # current <chr>, depth <dbl>, relative_depth <chr>, management <chr>,
#> # management_secondary <chr>, management_est_year <lgl>, management_size <lgl>,
#> # management_parties <lgl>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <lgl>, …To access Benthic PQT data, change method to
“benthicpqt”:
glovers_atoll <- my_projects %>%
filter(name == "Belize Glover's Atoll 2020")
glovers_atoll %>%
mermaid_get_project_data(method = "benthicpqt", data = "observations")
#> # A tibble: 102 × 51
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 2 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 3 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 4 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 5 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 6 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 7 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 8 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 9 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 10 Belize Glover'… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> # ℹ 92 more rows
#> # ℹ 43 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <lgl>, tide <chr>, visibility <chr>, current <chr>,
#> # depth <dbl>, relative_depth <chr>, management <chr>, management_secondary <lgl>,
#> # management_est_year <lgl>, management_size <lgl>, management_parties <chr>,
#> # management_compliance <chr>, management_rules <chr>, sample_date <date>,
#> # transect_number <dbl>, label <dbl>, …You can access sample units and sample events the same way.
Sample units contains percent cover per sample unit, by benthic category and by life histories.
glovers_atoll %>%
mermaid_get_project_data(method = "benthicpqt", data = "sampleunits")
#> # A tibble: 3 × 56
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 Belize Glover's… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 2 Belize Glover's… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 3 Belize Glover's… Sharla Gelfan… Belize https://dat… WCS … CZFR1 16.7 -87.8
#> # ℹ 48 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <lgl>, tide <chr>, visibility <chr>, current <chr>,
#> # depth <dbl>, relative_depth <chr>, management <chr>, management_secondary <lgl>,
#> # management_est_year <lgl>, management_size <lgl>, management_parties <chr>,
#> # management_compliance <chr>, management_rules <chr>, sample_date <date>,
#> # transect_number <dbl>, label <dbl>, …Sample events contains mean percent cover per sample event, by benthic category and by life histories, and standard deviations for these values:
glovers_atoll %>%
mermaid_get_project_data(method = "benthicpqt", data = "sampleevents")
#> # A tibble: 3 × 67
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 876652a… Belize… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 2 b857fb3… Belize… Sharla Gelfan… Camero… https://dat… WCS … test 44.1 -90.8
#> 3 b09ee87… Belize… Sharla Gelfan… Belize https://dat… WCS … CZFR1 16.7 -87.8
#> # ℹ 58 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <chr>, current <chr>, depth_avg <dbl>, depth_sd <lgl>,
#> # management <chr>, management_secondary <lgl>, management_est_year <lgl>,
#> # management_size <lgl>, management_parties <chr>, management_compliance <chr>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, num_points_nonother <dbl>, site_notes <lgl>, …To access Macroinvertebrate data, set method to
“macroinvertebrate”.
Observations data includes size, count, and density, with a full breakdown of macroinvertebrate class, order, family, genus, and group of interest, along with the size, count, and density.
glovers_atoll %>%
mermaid_get_project_data(method = "macroinvertebrate", data = "observations")
#> # A tibble: 56 × 51
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 2 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 3 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 4 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 5 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 6 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 7 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 8 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 9 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 10 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> # ℹ 46 more rows
#> # ℹ 43 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <chr>,
#> # current <chr>, depth <dbl>, relative_depth <chr>, management <chr>,
#> # management_secondary <lgl>, management_est_year <dbl>, management_size <dbl>,
#> # management_parties <chr>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <chr>, …Sample units data returns total abundance and density, as well as density by group of interest, and sample events contain density per sample event, by group of interest, and standard deviations of these values.
glovers_atoll %>%
mermaid_get_project_data(method = "macroinvertebrate", data = "sampleunits")
#> # A tibble: 11 × 57
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 2 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1207 -2.02 134.
#> 3 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 4 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 5 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 6 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1207 -2.02 134.
#> 7 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1207 -2.02 134.
#> 8 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 9 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1201 -2.02 134.
#> 10 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1207 -2.02 134.
#> 11 Belize Glover'… Sharla Gelfan… Indone… https://dat… WCS … 1207 -2.02 134.
#> # ℹ 49 more variables: reef_exposure <chr>, reef_slope <chr>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <chr>, visibility <chr>,
#> # current <chr>, depth <dbl>, relative_depth <chr>, management <chr>,
#> # management_secondary <lgl>, management_est_year <dbl>, management_size <dbl>,
#> # management_parties <chr>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, transect_number <dbl>, label <chr>, …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 × 51
#> project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 2 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 3 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 4 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 5 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 6 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 7 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 8 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 9 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Para… -14.4 40.7
#> 10 WCS Mozambique… Emily Darling… Mozamb… https://dat… WCS … Pemb… -13.0 40.6
#> # ℹ 1,804 more rows
#> # ℹ 43 more variables: reef_exposure <chr>, quadrat_size <dbl>, reef_type <chr>,
#> # reef_zone <chr>, sample_time <time>, tide <lgl>, visibility <lgl>,
#> # current <lgl>, depth <dbl>, relative_depth <lgl>, management <chr>,
#> # management_secondary <lgl>, management_est_year <dbl>, management_size <lgl>,
#> # management_parties <chr>, management_compliance <chr>, management_rules <chr>,
#> # sample_date <date>, observers <chr>, label <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 × 70
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 1c2d7c… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Kisi… -11.0 40.7
#> 2 cff142… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Kisi… -11.0 40.7
#> 3 de6b40… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Kisi… -11.0 40.7
#> 4 038fe4… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 5 fcff6a… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Two … -21.8 35.5
#> 6 f33ff1… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Luta… -12.3 40.6
#> 7 0cce99… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pang… -11.0 40.6
#> 8 16a690… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Baby… -11.0 40.7
#> 9 1e04f6… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Zala… -12.0 40.6
#> 10 12a569… WCS Mo… Emily Darling… Mozamb… https://dat… WCS … Pemb… -13.0 40.6
#> # ℹ 52 more rows
#> # ℹ 61 more variables: reef_exposure <chr>, quadrat_size_avg <dbl>, reef_type <chr>,
#> # reef_zone <chr>, tide <lgl>, visibility <lgl>, current <lgl>, depth_avg <dbl>,
#> # depth_sd <dbl>, management <chr>, management_secondary <lgl>,
#> # management_est_year <dbl>, management_size <lgl>, management_parties <chr>,
#> # management_compliance <chr>, management_rules <chr>, sample_date <date>,
#> # observers <chr>, sample_unit_count <dbl>, count_total_avg <dbl>, …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 × 36
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 dcd4b4b… XPDC K… Amkieltiela A… Indone… https://dat… NA KE22 -5.85 133.
#> 2 db26481… XPDC K… Amkieltiela A… Indone… https://dat… NA KE24 -5.93 133.
#> # ℹ 27 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <chr>, current <chr>, depth_avg <dbl>, depth_sd <dbl>,
#> # management <chr>, management_secondary <chr>, management_est_year <lgl>,
#> # management_size <lgl>, management_parties <lgl>, management_compliance <lgl>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, score_avg_avg <dbl>, score_avg_sd <dbl>, …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 × 66
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <lgl> <chr> <dbl> <dbl>
#> 1 15ed4d… XPDC K… Amkieltiela A… Indone… https://dat… NA KE02 -5.44 133.
#> 2 eda605… XPDC K… Amkieltiela A… Indone… https://dat… NA KE36 -5.88 133.
#> 3 210144… XPDC K… Amkieltiela A… Indone… https://dat… NA KE06 -5.52 132.
#> 4 3cc8e1… XPDC K… Amkieltiela A… Indone… https://dat… NA KE23 -5.80 133.
#> 5 a009b4… XPDC K… Amkieltiela A… Indone… https://dat… NA KE18 -5.70 133.
#> 6 05a34e… XPDC K… Amkieltiela A… Indone… https://dat… NA KE13 -5.51 133.
#> 7 40afd0… XPDC K… Amkieltiela A… Indone… https://dat… NA KE19 -5.73 133.
#> 8 06ae70… XPDC K… Amkieltiela A… Indone… https://dat… NA KE31 -5.78 133.
#> 9 1f7061… XPDC K… Amkieltiela A… Indone… https://dat… NA KE20 -5.67 133.
#> 10 531f64… XPDC K… Amkieltiela A… Indone… https://dat… NA KE40 -6.00 132.
#> # ℹ 28 more rows
#> # ℹ 57 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <chr>, current <chr>, depth_avg <dbl>, depth_sd <dbl>,
#> # management <chr>, management_secondary <chr>, management_est_year <lgl>,
#> # management_size <lgl>, management_parties <lgl>, management_compliance <chr>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, site_notes <lgl>, management_notes <lgl>, …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" "benthicpit" "benthicpqt" "benthiclit"
#> [5] "habitatcomplexity" "bleaching" "macroinvertebrate"
names(all_project_data[["benthicpit"]])
#> [1] "observations" "sampleunits" "sampleevents"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.
my_projects
#> # A tibble: 16 × 21
#> id name countries num_sites num_active_sample_un…¹ num_sample_units tags
#> <chr> <chr> <chr> <int> <int> <dbl> <chr>
#> 1 e1efb1e0-… 2016… Fiji 9 10 80 WCS …
#> 2 170e7182-… 2018… Fiji 10 5 121 WCS …
#> 3 d065cba4-… 2019… Fiji 31 3 32 WCS …
#> 4 1fbdb9ea-… a2 Canada; … 9 9 0 WWF-…
#> 5 3a9ecb7c-… Aceh… Indonesia 18 54 199 WCS …
#> 6 bacd3529-… Beli… Belize; … 39 136 260 WCS …
#> 7 a1b7ff1f-… Grea… Fiji 76 8 648 Fiji…
#> 8 507d1af9-… Kari… Indonesia 43 18 842 WCS …
#> 9 75ef7a5a-… Kubu… Fiji 78 1 1145 WCS …
#> 10 5679ef3d-… Mada… Madagasc… 33 0 49 WCS …
#> 11 4080679f-… Mada… Madagasc… 74 4 84 WCS …
#> 12 4d79339f-… MERM… Indonesi… 13 73 31 test…
#> 13 2c0c9857-… Shar… Canada; … 28 61 7 <NA>
#> 14 02e6915c-… TWP … Indonesia 14 10 2 WCS …
#> 15 2d6cee25-… WCS … Mozambiq… 74 6 247 WCS …
#> 16 9de82789-… XPDC… Indonesia 37 71 450 <NA>
#> # ℹ abbreviated name: ¹num_active_sample_units
#> # ℹ 14 more variables: suggested_citation <chr>, bbox <df[,4]>, notes <chr>,
#> # status <chr>, data_policy_beltfish <chr>, data_policy_benthiclit <chr>,
#> # data_policy_benthicpit <chr>, data_policy_habitatcomplexity <chr>,
#> # data_policy_bleachingqc <chr>, data_policy_benthicpqt <chr>,
#> # data_policy_macroinvertebrate <chr>, includes_gfcr <lgl>, created_on <chr>,
#> # updated_on <chr>
my_projects %>%
head(5) %>%
mermaid_get_project_data("fishbelt", "sampleevents", limit = 1)
#> # A tibble: 3 × 138
#> id project project_admins country contact_link tags site latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 8ad2272… 2016_N… Yashika Nand,… Fiji https://dat… WCS … C3 -17.1 179.
#> 2 4cb7f01… 2018_V… ICRS 2022 Tes… Fiji https://dat… WCS … VIR1 -17.3 178.
#> 3 accd066… Aceh J… Muhidin 10051… Indone… https://dat… WCS … Pula… 4.78 95.4
#> # ℹ 129 more variables: reef_exposure <chr>, reef_type <chr>, reef_zone <chr>,
#> # tide <chr>, visibility <chr>, current <chr>, depth_avg <dbl>, depth_sd <dbl>,
#> # management <chr>, management_secondary <lgl>, management_est_year <dbl>,
#> # management_size <lgl>, management_parties <chr>, management_compliance <chr>,
#> # management_rules <chr>, sample_date <date>, observers <chr>,
#> # sample_unit_count <dbl>, biomass_kgha_avg <dbl>, biomass_kgha_sd <dbl>, …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.