Summary

To address:

1. Sites:

  • Mozambique: add latitude, longitude, reef type, reef zone, and exposure

  • Honduras: add latitude, longitude, reef type, reef zone, and exposure

  • Indonesia: add reef type, reef zone, and exposure

  • Philippines: add reef type, reef zone, and exposure

2. Missing data in required fields

  • Mozambique: add Methodology, Depth, and Benthic Attribute

  • Honduras: add Methodology, Date, Depth, and Benthic Attribute

  • Indonesia: add Depth, and Benthic Attribute (can get some from old_attribute - that’s why I left that column)

  • Philippines: Management, Date, Depth, and Benthic Attribute (can get some from old_attribute - that’s why I left that column)

#Read in data
ff2_habitat <- read_csv(here("Mermaid Ingest Data", "Historical","ff2_habitat.csv"))

ff2_fish <- read_csv(here("Mermaid Ingest Data", "Historical","ff2_fish.csv"))

Unique Sites: Latitude, Longitude, and Management Regime (comparison w/FF2.0_fish)

1. Mozambique

## Filter country == "Mozambique"
ff2_habitat_moz <- ff2_habitat %>%
  filter(country == "Mozambique")

ff2_fish_moz <- ff2_fish %>%
  filter(country == "Mozambique")


##########

# Get unique sites (location_name)
ff2_habitat_moz_sites <- ff2_habitat_moz %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

ff2_fish_moz_sites <- ff2_fish_moz %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

# Check for locations with the same name but different latitudes or longitudes
locations_with_different_coords_moz <- ff2_habitat_moz %>%
  group_by(location_name) %>%
  summarise(
    Unique_Lats = n_distinct(lat),
    Unique_Lons = n_distinct(lon),
    .groups = "drop") %>%
  filter(Unique_Lats > 1 | Unique_Lons > 1) # Filter for locations with more than one unique latitude or longitude


# Check if sites from FF2.0_habitat match sites from FF2.0_fish
unique_habitat_moz_sites <- setdiff(ff2_habitat_moz_sites$location_name, ff2_fish_moz_sites$location_name)

if(length(unique_habitat_moz_sites) > 0) {
  print("Sites present in ff2_habitat but not in ff2_fish:")
  print(unique_habitat_moz_sites)
} else {
  print("All sites in ff2_habitat are also present in ff2_fish.")
}
## [1] "Sites present in ff2_habitat but not in ff2_fish:"
## [1] "Luanda"         "Quissanga"      "Memba_Mecuta_4" "Memba_Nauguema"
## [5] "Memba_Mecuta_1"
##########

# Check for the most similar site of FF2.0_fish for the unique sites in FF2.0_habitat

# Prepare an empty dataframe to store results
results_moz <- data.frame(unique_site_habitat = character(), closest_match_fish = character(), stringsAsFactors = FALSE)
# Loop through each unique site to find the closest match
for(site in unique_habitat_moz_sites) {
  distances <- stringdist::stringdist(site, ff2_fish_moz_sites$location_name) # Calculate the string distance
  min_distance_index <- which.min(distances)  # Find the index of the minimum distance
  closest_match <- ff2_fish_moz_sites$location_name[min_distance_index] # Find the closest matching site name
  results_moz <- rbind(results_moz, data.frame(unique_site_habitat = site, closest_match_fish = closest_match)) # Add to the results dataframe
}

# View Closest Match
results_moz %>%
  kable(caption = "Table 1. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 1. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset
unique_site_habitat closest_match_fish
Luanda Luanda_1
Quissanga Quissanga3
Memba_Mecuta_4 Mecuta_2
Memba_Nauguema Mecumbo
Memba_Mecuta_1 Mecuta_1
##########

# Clean Sites
selected_ff2_habitat_moz_sites <- ff2_habitat_moz_sites %>%
  select(
    name = location_name,
    latitude = lat,
    longitude = lon,
    management = location_status) %>%
  mutate(
    country = "Mozambique",
    notes = NA,
    reef_type = NA,
    reef_zone = NA,
    exposure = NA)

# View Clean Sites
selected_ff2_habitat_moz_sites %>%
  kable(caption = "Table 2. Complete list of sites in the ff2_habitat dataset and required information") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 2. Complete list of sites in the ff2_habitat dataset and required information
name latitude longitude management country notes reef_type reef_zone exposure
Luanda NA NA Reserve Mozambique NA NA NA NA
Quissanga NA NA Reserve Mozambique NA NA NA NA
Memba_Mecuta_4 NA NA Reserve Mozambique NA NA NA NA
Memba_Nauguema NA NA Managed Access Mozambique NA NA NA NA
Memba_Mecuta_1 NA NA Reserve Mozambique NA NA NA NA

2. Honduras

## Filter country == "Honduras"
ff2_habitat_hon <- ff2_habitat %>%
  filter(country == "Honduras")

ff2_fish_hon <- ff2_fish %>%
  filter(country == "Honduras")


##########

# Get unique sites (location_name)
ff2_habitat_hon_sites <- ff2_habitat_hon %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

ff2_fish_hon_sites <- ff2_fish_hon %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

# Check for locations with the same name but different latitudes or longitudes
locations_with_different_coords_hon <- ff2_habitat_hon %>%
  group_by(location_name) %>%
  summarise(
    Unique_Lats = n_distinct(lat),
    Unique_Lons = n_distinct(lon),
    .groups = "drop") %>%
  filter(Unique_Lats > 1 | Unique_Lons > 1) # Filter for locations with more than one unique latitude or longitude


# Check if sites from FF2.0_habitat match sites from FF2.0_fish
unique_habitat_hon_sites <- setdiff(ff2_habitat_hon_sites$location_name, ff2_fish_hon_sites$location_name)

if(length(unique_habitat_hon_sites) > 0) {
  print("Sites present in ff2_habitat but not in ff2_fish:")
  print(unique_habitat_hon_sites)
} else {
  print("All sites in ff2_habitat are also present in ff2_fish.")
}
## [1] "Sites present in ff2_habitat but not in ff2_fish:"
##  [1] "11"          "8"           "CAYO BLANCO" "BAJO SECO"   "MIL3"       
##  [6] "MIL1"        "MIL2"        "MBPC-4"      "MBPC-8"      "MBPC-2"     
## [11] "MBPC-1"      "MBPC-7"      "MBPC-5"      "NMSF1"       "MBPC-6"
##########

# Check for the most similar site of FF2.0_fish for the unique sites in FF2.0_habitat

# Prepare an empty dataframe to store results
results_hon <- data.frame(unique_site_habitat = character(), closest_match_fish = character(), stringsAsFactors = FALSE)
# Loop through each unique site to find the closest match
for(site in unique_habitat_hon_sites) {
  distances <- stringdist::stringdist(site, ff2_fish_hon_sites$location_name) # Calculate the string distance
  min_distance_index <- which.min(distances)  # Find the index of the minimum distance
  closest_match <- ff2_fish_hon_sites$location_name[min_distance_index] # Find the closest matching site name
  results_hon <- rbind(results_hon, data.frame(unique_site_habitat = site, closest_match_fish = closest_match)) # Add to the results dataframe
}

# View Closest Match
results_hon %>%
  kable(caption = "Table 3. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 3. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset
unique_site_habitat closest_match_fish
11 18
8 18
CAYO BLANCO Cayo Blanco
BAJO SECO UOIA2
MIL3 Gmc3
MIL1 GMIA1
MIL2 GMIA2
MBPC-4 5MBPC
MBPC-8 5MBPC
MBPC-2 Mil-2
MBPC-1 Mil-1
MBPC-7 5MBPC
MBPC-5 5MBPC
NMSF1 MSF1
MBPC-6 5MBPC
##########

# Clean Sites
selected_ff2_habitat_hon_sites <- ff2_habitat_hon_sites %>%
  select(
    name = location_name,
    latitude = lat,
    longitude = lon,
    management = location_status) %>%
  mutate(
    country = "Honduras",
    notes = NA,
    reef_type = NA,
    reef_zone = NA,
    exposure = NA)

# View Clean Sites
selected_ff2_habitat_hon_sites %>%
  kable(caption = "Table 4. Complete list of sites in the ff2_habitat dataset and required information") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 4. Complete list of sites in the ff2_habitat dataset and required information
name latitude longitude management country notes reef_type reef_zone exposure
10 -86.309 16.397 Reserve Honduras NA NA NA NA
11 -86.299 16.398 Reserve Honduras NA NA NA NA
18 -86.345 16.390 Reserve Honduras NA NA NA NA
19 -86.351 16.389 Reserve Honduras NA NA NA NA
20 -86.347 16.389 Reserve Honduras NA NA NA NA
21 -86.324 16.391 Reserve Honduras NA NA NA NA
22 -86.262 16.409 Reserve Honduras NA NA NA NA
7 -86.289 16.400 Reserve Honduras NA NA NA NA
8 -86.274 16.406 Reserve Honduras NA NA NA NA
UOIA2 NA NA Reserve Honduras NA NA NA NA
UWIA2 NA NA Reserve Honduras NA NA NA NA
6 -86.313 16.394 Reserve Honduras NA NA NA NA
CAYO BLANCO NA NA Reserve Honduras NA NA NA NA
UOCA1 NA NA Reserve Honduras NA NA NA NA
BAJO SECO NA NA Reserve Honduras NA NA NA NA
MIL3 NA NA Reserve Honduras NA NA NA NA
MIL1 NA NA Reserve Honduras NA NA NA NA
MIL2 NA NA Reserve Honduras NA NA NA NA
MBPC-4 NA NA Reserve Honduras NA NA NA NA
MBPC-8 NA NA Reserve Honduras NA NA NA NA
17 -86.264 16.410 Reserve Honduras NA NA NA NA
MBPC-2 NA NA Reserve Honduras NA NA NA NA
MBPC-1 NA NA Reserve Honduras NA NA NA NA
MBPC-7 NA NA Reserve Honduras NA NA NA NA
MBPC-5 NA NA Reserve Honduras NA NA NA NA
NMSF1 NA NA Reserve Honduras NA NA NA NA
MBPC-6 NA NA Reserve Honduras NA NA NA NA

3. Indonesia

## Filter country == "Indonesia"
ff2_habitat_ind <- ff2_habitat %>%
  filter(country == "Indonesia")

ff2_fish_ind <- ff2_fish %>%
  filter(country == "Indonesia")


##########

# Get unique sites (location_name)
ff2_habitat_ind_sites <- ff2_habitat_ind %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

ff2_fish_ind_sites <- ff2_fish_ind %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

# Check for locations with the same name but different latitudes or longitudes
locations_with_different_coords_ind <- ff2_habitat_ind %>%
  group_by(location_name) %>%
  summarise(
    Unique_Lats = n_distinct(lat),
    Unique_Lons = n_distinct(lon),
    .groups = "drop") %>%
  filter(Unique_Lats > 1 | Unique_Lons > 1) # Filter for locations with more than one unique latitude or longitude


# Check if sites from FF2.0_habitat match sites from FF2.0_fish
unique_habitat_ind_sites <- setdiff(ff2_habitat_ind_sites$location_name, ff2_fish_ind_sites$location_name)

if(length(unique_habitat_ind_sites) > 0) {
  print("Sites present in ff2_habitat but not in ff2_fish:")
  print(unique_habitat_ind_sites)
} else {
  print("All sites in ff2_habitat are also present in ff2_fish.")
}
## [1] "Sites present in ff2_habitat but not in ff2_fish:"
##  [1] "KULIS9"  "MAWAS10" "MAWAS9"  "SIONT8"  "WABUL11" "WABUL10" "WABUL12"
##  [8] "KAPUN10" "KAPUN9"  "SIONT9"
##########

# Check for the most similar site of FF2.0_fish for the unique sites in FF2.0_habitat

# Prepare an empty dataframe to store results
results_ind <- data.frame(unique_site_habitat = character(), closest_match_fish = character(), stringsAsFactors = FALSE)
# Loop through each unique site to find the closest match
for(site in unique_habitat_ind_sites) {
  distances <- stringdist::stringdist(site, ff2_fish_ind_sites$location_name) # Calculate the string distance
  min_distance_index <- which.min(distances)  # Find the index of the minimum distance
  closest_match <- ff2_fish_ind_sites$location_name[min_distance_index] # Find the closest matching site name
  results_ind <- rbind(results_ind, data.frame(unique_site_habitat = site, closest_match_fish = closest_match)) # Add to the results dataframe
}

# View Closest Match
results_ind %>%
  kable(caption = "Table 5. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 5. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset
unique_site_habitat closest_match_fish
KULIS9 KULIS6
MAWAS10 MAWAS1
MAWAS9 MAWAS6
SIONT8 SIONT1
WABUL11 WABUL1
WABUL10 WABUL1
WABUL12 WABUL1
KAPUN10 KAPUN1
KAPUN9 KAPUN3
SIONT9 SIONT1
##########

# Clean Sites
selected_ff2_habitat_ind_sites <- ff2_habitat_ind_sites %>%
  select(
    name = location_name,
    latitude = lat,
    longitude = lon,
    management = location_status) %>%
  mutate(
    country = "Indonesia",
    notes = NA,
    reef_type = NA,
    reef_zone = NA,
    exposure = NA)

# View Clean Sites
selected_ff2_habitat_ind_sites %>%
  kable(caption = "Table 6. Complete list of sites in the ff2_habitat dataset and required information") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 6. Complete list of sites in the ff2_habitat dataset and required information
name latitude longitude management country notes reef_type reef_zone exposure
MAGIN1 -4.773270 122.2612 Managed Access Indonesia NA NA NA NA
TIWOR1 -4.577300 122.3029 Managed Access Indonesia NA NA NA NA
TALRAY1 -5.475970 121.9236 Reserve Indonesia NA NA NA NA
TIWOR2 -4.584460 122.3318 Managed Access Indonesia NA NA NA NA
MORAM6 -4.126240 122.7300 Managed Access Indonesia NA NA NA NA
TALRAY2 -5.493100 121.9344 Managed Access Indonesia NA NA NA NA
WAWON6 -4.024780 123.2237 Reserve Indonesia NA NA NA NA
SAGOR4 -5.307930 121.7637 Managed Access Indonesia NA NA NA NA
MATAO6 -4.815140 122.1524 Managed Access Indonesia NA NA NA NA
SAGOR2 -5.336950 121.7592 Managed Access Indonesia NA NA NA NA
TALRAY5 -5.492530 122.0793 Reserve Indonesia NA NA NA NA
WAWON1 -4.014850 123.0779 Managed Access Indonesia NA NA NA NA
SAGOR6 -5.236780 121.7700 Managed Access Indonesia NA NA NA NA
WAWON4 -4.007610 123.1792 Managed Access Indonesia NA NA NA NA
KULIS3 -4.785520 123.1521 Managed Access Indonesia NA NA NA NA
MAGIN6 -4.935120 122.3208 Managed Access Indonesia NA NA NA NA
TALRAY3 -5.521450 121.9936 Managed Access Indonesia NA NA NA NA
TALRAY4 -5.488320 122.0547 Reserve Indonesia NA NA NA NA
TIWOR6 -4.659100 122.2920 Managed Access Indonesia NA NA NA NA
KULIS6 -4.834370 123.1691 Managed Access Indonesia NA NA NA NA
MATAO1 -4.919540 122.0871 Managed Access Indonesia NA NA NA NA
SIOMP2 -5.668520 122.4844 Reserve Indonesia NA NA NA NA
SAGOR1 -5.347380 121.7802 Managed Access Indonesia NA NA NA NA
MAWAS2 -5.276720 122.2685 Managed Access Indonesia NA NA NA NA
MAGIN3 -4.818580 122.2910 Managed Access Indonesia NA NA NA NA
SIONT6 -5.417000 123.0895 Managed Access Indonesia NA NA NA NA
PASIK3 -5.091880 122.6150 Managed Access Indonesia NA NA NA NA
PASIK4 -5.122900 122.6139 Managed Access Indonesia NA NA NA NA
SIOMP1 -5.680430 122.4592 Managed Access Indonesia NA NA NA NA
MAWAS6 -5.398340 122.2737 Managed Access Indonesia NA NA NA NA
SIOMP4 -5.687150 122.5472 Managed Access Indonesia NA NA NA NA
PASIK5 -5.184880 122.6174 Managed Access Indonesia NA NA NA NA
KAPUN1 -5.233840 122.7005 Managed Access Indonesia NA NA NA NA
KAPUN2 -5.185560 122.7341 Reserve Indonesia NA NA NA NA
KAPUN3 -5.202110 122.7178 Reserve Indonesia NA NA NA NA
KAPUN4 -5.250150 122.7013 Managed Access Indonesia NA NA NA NA
KAPUN5 -5.101370 122.7512 Managed Access Indonesia NA NA NA NA
KULIS1 -4.813420 123.1210 Managed Access Indonesia NA NA NA NA
KULIS2 -5.310750 123.2088 Managed Access Indonesia NA NA NA NA
KULIS4 -4.815980 123.1684 Managed Access Indonesia NA NA NA NA
KULIS5 -4.819220 123.1670 Managed Access Indonesia NA NA NA NA
LABEN1 -3.572450 122.3690 Managed Access Indonesia NA NA NA NA
LABEN2 -3.571350 122.3506 Managed Access Indonesia NA NA NA NA
LABEN3 -3.564040 122.3488 Managed Access Indonesia NA NA NA NA
LABEN4 -3.493200 122.4787 Managed Access Indonesia NA NA NA NA
LABEN5 -3.479930 122.4900 Managed Access Indonesia NA NA NA NA
LABEN6 -3.493350 122.4872 Managed Access Indonesia NA NA NA NA
LASOL1 -3.684640 122.4237 Managed Access Indonesia NA NA NA NA
LASOL2 -3.687940 122.4245 Managed Access Indonesia NA NA NA NA
LASOL3 -3.748300 122.3667 Managed Access Indonesia NA NA NA NA
LASOL4 -3.735340 122.3513 Managed Access Indonesia NA NA NA NA
LASOL5 -3.726220 122.3916 Managed Access Indonesia NA NA NA NA
LASOL6 -3.743650 122.4359 Managed Access Indonesia NA NA NA NA
MAGIN2 -4.762080 122.3408 Managed Access Indonesia NA NA NA NA
MAGIN4 -4.843100 122.2163 Managed Access Indonesia NA NA NA NA
MAGIN5 -4.864190 122.2558 Managed Access Indonesia NA NA NA NA
MATAO2 -4.889770 122.0522 Managed Access Indonesia NA NA NA NA
MATAO3 -4.890970 122.0386 Managed Access Indonesia NA NA NA NA
MATAO4 -4.845670 122.1183 Managed Access Indonesia NA NA NA NA
MATAO5 -4.839170 122.1449 Managed Access Indonesia NA NA NA NA
MAWAS1 -5.223530 122.2644 Reserve Indonesia NA NA NA NA
MAWAS3 -5.284810 122.2524 Managed Access Indonesia NA NA NA NA
MAWAS4 -5.359610 122.2608 Managed Access Indonesia NA NA NA NA
MAWAS5 -5.372960 122.2633 Managed Access Indonesia NA NA NA NA
MORAM1 -4.078630 122.7695 Reserve Indonesia NA NA NA NA
MORAM2 -4.108580 122.8008 Reserve Indonesia NA NA NA NA
MORAM3 -4.115640 122.8221 Reserve Indonesia NA NA NA NA
MORAM4 -4.150660 122.7818 Reserve Indonesia NA NA NA NA
MORAM5 -4.150960 122.7603 Managed Access Indonesia NA NA NA NA
PASIK1 -4.967140 122.7837 Managed Access Indonesia NA NA NA NA
PASIK2 -4.967300 122.7521 Managed Access Indonesia NA NA NA NA
PASIK6 -5.051220 122.7344 Managed Access Indonesia NA NA NA NA
PASIK7 -5.101100 122.7027 Managed Access Indonesia NA NA NA NA
SAGOR3 -5.359740 121.7377 Managed Access Indonesia NA NA NA NA
SAGOR5 -5.280030 121.7557 Managed Access Indonesia NA NA NA NA
SIOMP3 -5.635550 122.4945 Managed Access Indonesia NA NA NA NA
SIOMP5 -5.627600 122.5402 Reserve Indonesia NA NA NA NA
SIOMP6 -5.620370 122.5191 Reserve Indonesia NA NA NA NA
SIONT1 -5.315530 123.2033 Reserve Indonesia NA NA NA NA
SIONT2 -5.341450 123.1920 Managed Access Indonesia NA NA NA NA
SIONT3 -5.372430 123.1683 Managed Access Indonesia NA NA NA NA
SIONT4 -5.381840 123.1518 Reserve Indonesia NA NA NA NA
SIONT5 -5.404840 123.1265 Reserve Indonesia NA NA NA NA
TALRAY6 -5.488290 122.0714 Managed Access Indonesia NA NA NA NA
TIWOR3 -4.630960 122.3314 Managed Access Indonesia NA NA NA NA
TIWOR4 -4.644800 122.3329 Managed Access Indonesia NA NA NA NA
TIWOR5 -4.636370 122.3636 Managed Access Indonesia NA NA NA NA
WABUL1 -5.613580 122.8693 Managed Access Indonesia NA NA NA NA
WABUL2 -5.617520 122.8665 Managed Access Indonesia NA NA NA NA
WABUL3 -5.621360 122.8618 Managed Access Indonesia NA NA NA NA
WABUL4 -5.621350 122.8547 Managed Access Indonesia NA NA NA NA
WABUL5 -5.627270 122.8519 Managed Access Indonesia NA NA NA NA
WABUL6 -5.631680 122.8478 Managed Access Indonesia NA NA NA NA
WAWON2 -4.008000 123.1356 Reserve Indonesia NA NA NA NA
WAWON3 -4.010450 123.1517 Reserve Indonesia NA NA NA NA
WAWON5 -4.016550 123.2126 Reserve Indonesia NA NA NA NA
NTZ2 -4.410880 122.7739 Reserve Indonesia NA NA NA NA
WAWON2 -4.008000 123.1356 Managed Access Indonesia NA NA NA NA
UZ2 -4.424980 122.7985 Managed Access Indonesia NA NA NA NA
MAGIN7 -4.887720 122.2896 Reserve Indonesia NA NA NA NA
MORAM2 -4.108580 122.8008 Managed Access Indonesia NA NA NA NA
TIWOR7 -4.698160 122.3921 Reserve Indonesia NA NA NA NA
MAGIN4 -4.843100 122.2163 Reserve Indonesia NA NA NA NA
SAGOR7 -5.124580 121.8196 Reserve Indonesia NA NA NA NA
WABUL9 -5.615430 122.8690 Managed Access Indonesia NA NA NA NA
MORAM3 -4.115640 122.8221 Managed Access Indonesia NA NA NA NA
MATAO4 -4.845670 122.1183 Reserve Indonesia NA NA NA NA
MORAM5 -4.150960 122.7603 Reserve Indonesia NA NA NA NA
TIWOR4 -4.644800 122.3329 Reserve Indonesia NA NA NA NA
UZ1 -4.396010 122.7592 Managed Access Indonesia NA NA NA NA
NTZ1 -4.387720 122.7492 Reserve Indonesia NA NA NA NA
WAWON7 -3.994740 122.9681 Managed Access Indonesia NA NA NA NA
MATAO2 -4.889770 122.0522 Reserve Indonesia NA NA NA NA
SAGOR3 -5.359740 121.7377 Reserve Indonesia NA NA NA NA
MORAM7 -4.149720 122.8037 Managed Access Indonesia NA NA NA NA
MATAO5 -4.839170 122.1449 Reserve Indonesia NA NA NA NA
NTZ3 -4.437300 122.8443 Reserve Indonesia NA NA NA NA
WAWON8 -3.985420 123.0383 Managed Access Indonesia NA NA NA NA
KULIS9 -4.794360 123.1452 Reserve Indonesia NA NA NA NA
TALRAY7 -5.447630 122.0490 Managed Access Indonesia NA NA NA NA
WABUL8 -5.597890 122.8790 Reserve Indonesia NA NA NA NA
KAPUN6 -5.285550 122.6812 Managed Access Indonesia NA NA NA NA
PASIK6 -5.051220 122.7344 Reserve Indonesia NA NA NA NA
TIWOR3 -4.630960 122.3314 Reserve Indonesia NA NA NA NA
UZ3 -4.422840 122.8616 Managed Access Indonesia NA NA NA NA
WABUL7 -5.588920 122.8859 Managed Access Indonesia NA NA NA NA
KULIS1 -4.813420 123.1210 Reserve Indonesia NA NA NA NA
KULIS8 -4.807500 123.1670 Reserve Indonesia NA NA NA NA
MAGIN5 -4.864190 122.2558 Reserve Indonesia NA NA NA NA
MORAM1 -4.078630 122.7695 Managed Access Indonesia NA NA NA NA
PASIK8 -5.098130 122.7240 Managed Access Indonesia NA NA NA NA
SIOMP6 -5.620370 122.5191 Managed Access Indonesia NA NA NA NA
SIONT7 -5.336570 123.1947 Reserve Indonesia NA NA NA NA
MAWAS10 -5.369890 122.2651 Reserve Indonesia NA NA NA NA
MAWAS8 -5.313160 122.2629 Managed Access Indonesia NA NA NA NA
MAWAS9 -5.356520 122.2597 Reserve Indonesia NA NA NA NA
SIONT4 -5.381840 123.1518 Managed Access Indonesia NA NA NA NA
SIONT8 -5.366950 123.1691 Reserve Indonesia NA NA NA NA
KAPUN7 -5.239890 122.7399 Managed Access Indonesia NA NA NA NA
MATAO7 -4.865492 122.0504 Managed Access Indonesia NA NA NA NA
MAWAS3 -5.284810 122.2524 Reserve Indonesia NA NA NA NA
MAWAS7 -5.398420 122.3273 Reserve Indonesia NA NA NA NA
WABUL11 -5.638410 122.8426 Reserve Indonesia NA NA NA NA
PASIK1 -4.967140 122.7837 Reserve Indonesia NA NA NA NA
SIONT1 -5.315530 123.2033 Managed Access Indonesia NA NA NA NA
KULIS7 -4.841110 123.1201 Managed Access Indonesia NA NA NA NA
SIOMP5 -5.627600 122.5402 Managed Access Indonesia NA NA NA NA
WABUL10 -5.617450 122.8514 Managed Access Indonesia NA NA NA NA
WABUL12 -5.655420 122.8220 Reserve Indonesia NA NA NA NA
KAPUN10 -5.162260 122.7427 Managed Access Indonesia NA NA NA NA
KAPUN4 -5.250150 122.7013 Reserve Indonesia NA NA NA NA
KAPUN8 -5.187170 122.7370 Reserve Indonesia NA NA NA NA
KAPUN9 -5.203590 122.7216 Reserve Indonesia NA NA NA NA
SIONT9 -5.404670 123.1194 Reserve Indonesia NA NA NA NA
PASIK2 -4.967300 122.7521 Reserve Indonesia NA NA NA NA
SIOMP7 -5.653730 122.4927 Reserve Indonesia NA NA NA NA

4. Philippines

## Filter country == "Philippines"
ff2_habitat_phi <- ff2_habitat %>%
  filter(country == "Philippines")

ff2_fish_phi <- ff2_fish %>%
  filter(country == "Philippines")


##########

# Get unique sites (location_name)
ff2_habitat_phi_sites <- ff2_habitat_phi %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

ff2_fish_phi_sites <- ff2_fish_phi %>%
  group_by(location_name, lat, lon, location_status) %>%
  summarise(Count = n(), .groups = "drop")%>%
  arrange(desc(Count))

# Check for locations with the same name but different latitudes or longitudes
locations_with_different_coords_phi <- ff2_habitat_phi %>%
  group_by(location_name) %>%
  summarise(
    Unique_Lats = n_distinct(lat),
    Unique_Lons = n_distinct(lon),
    .groups = "drop") %>%
  filter(Unique_Lats > 1 | Unique_Lons > 1) # Filter for locations with more than one unique latitude or longitude


distinct_coords_for_varied_locations_phi <- ff2_habitat_phi %>%
  group_by(location_name) %>%
  distinct(location_name, lat, lon) %>%
  ungroup() %>%
  arrange(location_name, lat, lon)


# Function to calculate the central point (mean lat and lon) for each site
central_point <- function(df) {
  central_points <- df %>%
    group_by(location_name) %>%
    summarise(
      mean_lat = mean(lat, na.rm = TRUE),
      mean_lon = mean(lon, na.rm = TRUE)
    )
  
  return(central_points)
}

# Applying the function
central_point_phi <- central_point(ff2_habitat_phi)

# Merge the central points
ff2_habitat_phi_sites_management <- central_point_phi %>%
  left_join(ff2_habitat_phi %>% select(location_name, country, location_status) %>% distinct(), by = "location_name")




# Check if sites from FF2.0_habitat match sites from FF2.0_fish
unique_habitat_phi_sites <- setdiff(ff2_habitat_phi_sites$location_name, ff2_fish_phi_sites$location_name)
unique_habitat_phi_sites <- unique_habitat_phi_sites[!is.na(unique_habitat_phi_sites)]

if(length(unique_habitat_phi_sites) > 0) {
  print("Sites present in ff2_habitat but not in ff2_fish:")
  print(unique_habitat_phi_sites)
} else {
  print("All sites in ff2_habitat are also present in ff2_fish.")
}
## [1] "Sites present in ff2_habitat but not in ff2_fish:"
##   [1] "Talisay MPA"                    "Agay-ayan"                     
##   [3] "Corregidor MPA"                 "Bangaan"                       
##   [5] "Caloco"                         "T. Arlan MPA"                  
##   [7] "Burgos MPA"                     "Gen Luna MPA"                  
##   [9] "Cloud 9 propose MPA"            "Salvacion MPA"                 
##  [11] "Tambanan"                       "Maribojoc MPA"                 
##  [13] "Pamosaingan MPA"                "Takot Lawum"                   
##  [15] "Ermita"                         "Takut Siare"                   
##  [17] "Poblacion MPA"                  "Tinigbas"                      
##  [19] "Litayun MPA"                    "Buluan"                        
##  [21] "Diosan"                         "Mabuhay Marine Park"           
##  [23] "Punta Manobo"                   "Tandu-Balasa"                  
##  [25] "San Juan"                       "Sand Bar"                      
##  [27] "Daku Island"                    "Caub MPA"                      
##  [29] "Moyong MPA"                     "Pandilosan Is."                
##  [31] "Pucio"                          "Lampinigan"                    
##  [33] "Alegria MPA"                    "Iniban"                        
##  [35] "Pamosaingan MPA Station 2"      "Burgos MPA Station 1"          
##  [37] "Talisay MPA Station 1"          "General Luna MPA Station 1"    
##  [39] "Maribojoc MPA Station 1"        "Pamosaingan MPA Station 1"     
##  [41] "Patria MPA"                     "T. Arlan MPA Inside Station 1" 
##  [43] "Pilar Poblacion MPA Station 1"  "Cloud 9 Station 1"             
##  [45] "Puntod Shoal MPA"               "Dapdap MPA Station 1"          
##  [47] "Dapdap MPA Station 2"           "Pilar Salvacion MPA Station 1" 
##  [49] "Daku Outside Station 1"         "Calmante Station 2"            
##  [51] "Talisay Outside Station 1"      "Tuland Diot Station 2"         
##  [53] "Calmante Station 1"             "Villahermosa MPA"              
##  [55] "Mabini Station 3"               "Nag-Uban MPA"                  
##  [57] "Tuland Diot Station 1"          "Alegria MPA Inside Station 1"  
##  [59] "Inusukan Outside Station 2"     "Mabini MPA Station 1"          
##  [61] "T. Arlan MPA Outside Station 1" "Burgos MPA Station 2"          
##  [63] "Inusukan MPA Station 1"         "Inusukan MPA Station 2"        
##  [65] "Inusukan Outside Station 1"     "Mag-aba MPA"                   
##  [67] "PMP Outside"                    "Puertobello MPA"               
##  [69] "Cloud 9 Station 2"              "Mabini MPA Station 2"          
##  [71] "Maribojoc Outside Station 1"    "General Luna MPA Station 2"    
##  [73] "PMP Inside"                     "Pilar Salvacion MPA Station 2" 
##  [75] "Tingib MPA"                     "San Isidro MPA"                
##  [77] "Burgos Outside Station 1"       "Daku Outside Station 2"        
##  [79] "Abiera MPA"                     "San Isidro Outside"            
##  [81] "Alegria MPA Inside Station 2"   "Duyong outside"                
##  [83] "Idio MPA"                       "Pilar Poblacion MPA Station 2" 
##  [85] "Idiacacan MPA"                  "Burgos Outside Station 2"      
##  [87] "Burgos Outside Station 11"      "Burgos Outside Station 12"     
##  [89] "Burgos Outside Station 17"      "Burgos Outside Station 19"     
##  [91] "Burgos Outside Station 21"      "Burgos Outside Station 22"     
##  [93] "Burgos Outside Station 24"      "Burgos Outside Station 25"     
##  [95] "Burgos Outside Station 27"      "Burgos Outside Station 29"     
##  [97] "Burgos Outside Station 30"      "Burgos Outside Station 33"     
##  [99] "Burgos Outside Station 5"       "Burgos Outside Station 7"      
## [101] "Burgos Outside Station 9"
##########

# Check for the most similar site of FF2.0_fish for the unique sites in FF2.0_habitat

# Prepare an empty dataframe to store results
results_phi <- data.frame(unique_site_habitat = character(), closest_match_fish = character(), stringsAsFactors = FALSE)
# Loop through each unique site to find the closest match
for(site in unique_habitat_phi_sites) {
  distances <- stringdist::stringdist(site, ff2_fish_phi_sites$location_name) # Calculate the string distance
  min_distance_index <- which.min(distances)  # Find the index of the minimum distance
  closest_match <- ff2_fish_phi_sites$location_name[min_distance_index] # Find the closest matching site name
  results_phi <- rbind(results_phi, data.frame(unique_site_habitat = site, closest_match_fish = closest_match)) # Add to the results dataframe
}

# View Closest Match
results_phi %>%
  kable(caption = "Table 7. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 7. Unique sites in the ff2_habitat dataset and closest match from the ff2_fish dataset
unique_site_habitat closest_match_fish
Talisay MPA Iniban MS
Agay-ayan Ragnas
Corregidor MPA Corregidor
Bangaan Ragnas
Caloco Caub
T. Arlan MPA Iniban MS
Burgos MPA Burgos
Gen Luna MPA Iniban MS
Cloud 9 propose MPA Cloud 9 Outside Station 1
Salvacion MPA Malalison
Tambanan Ragnas
Maribojoc MPA Iniban MS
Pamosaingan MPA Iniban MS
Takot Lawum Mantalip
Ermita Uba
Takut Siare Mantalip
Poblacion MPA Poblacion
Tinigbas Ragnas
Litayun MPA Iniban MS
Buluan Burgos
Diosan Dapa2
Mabuhay Marine Park B: Mabuhay Marine Park
Punta Manobo Iniban MS
Tandu-Balasa Mantalip
San Juan Ragnas
Sand Bar Ragnas
Daku Island Gen. Island
Caub MPA Caub
Moyong MPA Iniban MS
Pandilosan Is. Iniban MS
Pucio Burgos
Lampinigan Ragnas
Alegria MPA Ragnas
Iniban Iniban MS
Pamosaingan MPA Station 2 Pamosaingan Inside Station 2
Burgos MPA Station 1 Burgos Inside Station 1
Talisay MPA Station 1 Talisay Inside Station 1
General Luna MPA Station 1 Abriera Inside Station 1
Maribojoc MPA Station 1 Maribojoc Inside Station 1
Pamosaingan MPA Station 1 Pamosaingan Inside Station 1
Patria MPA Ragnas
T. Arlan MPA Inside Station 1 T. Arlan Inside Station 1
Pilar Poblacion MPA Station 1 Poblacion Inside Station 1
Cloud 9 Station 1 Cloud 9 Outside Station 1
Puntod Shoal MPA Iniban MS
Dapdap MPA Station 1 Dapdap Inside Station1
Dapdap MPA Station 2 Dapdap Inside Station2
Pilar Salvacion MPA Station 1 Salvacion Inside Station 1
Daku Outside Station 1 Daku Is. Outside Station 1
Calmante Station 2 Talisay Outside Station 2
Talisay Outside Station 1 Talisay Outside Station 2
Tuland Diot Station 2 Tulang Diot Inside Station2
Calmante Station 1 Patria Inside Station 1
Villahermosa MPA Libertad2
Mabini Station 3 Mantalip
Nag-Uban MPA Iniban MS
Tuland Diot Station 1 Tulang Diot Inside Station1
Alegria MPA Inside Station 1 Alegria Inside Station 1
Inusukan Outside Station 2 Inusukan Outside Station3
Mabini MPA Station 1 Mabini MPA Inside Station1
T. Arlan MPA Outside Station 1 T. Arlan Outside Station 2
Burgos MPA Station 2 Burgos Inside Station 2
Inusukan MPA Station 1 Inusukan Inside Station1
Inusukan MPA Station 2 Inusukan Inside Station2
Inusukan Outside Station 1 Inusukan Outside Station3
Mag-aba MPA Ragnas
PMP Outside Malalison
Puertobello MPA Poblacion
Cloud 9 Station 2 Cloud 9 Outside Station 2
Mabini MPA Station 2 Mabini MPA Inside Station2
Maribojoc Outside Station 1 Maribojoc Outside Station 2
General Luna MPA Station 2 Talisay Outside Station 2
PMP Inside Malalison
Pilar Salvacion MPA Station 2 Salvacion Inside Station 2
Tingib MPA Iniban MS
San Isidro MPA San Antonio
Burgos Outside Station 1 Burgos Outside Station 4
Daku Outside Station 2 Daku Is. Outside Station 2
Abiera MPA Iniban MS
San Isidro Outside San Antonio
Alegria MPA Inside Station 2 Alegria Inside Station 2
Duyong outside Burgos
Idio MPA Iniban MS
Pilar Poblacion MPA Station 2 Poblacion Inside Station 2
Idiacacan MPA Iniban MS
Burgos Outside Station 2 Burgos Outside Station 4
Burgos Outside Station 11 Burgos Outside Station 4
Burgos Outside Station 12 Burgos Outside Station 4
Burgos Outside Station 17 Burgos Outside Station 4
Burgos Outside Station 19 Burgos Outside Station 4
Burgos Outside Station 21 Burgos Outside Station 4
Burgos Outside Station 22 Burgos Outside Station 4
Burgos Outside Station 24 Burgos Outside Station 4
Burgos Outside Station 25 Burgos Outside Station 4
Burgos Outside Station 27 Burgos Outside Station 4
Burgos Outside Station 29 Burgos Outside Station 4
Burgos Outside Station 30 Burgos Outside Station 3
Burgos Outside Station 33 Burgos Outside Station 3
Burgos Outside Station 5 Burgos Outside Station 4
Burgos Outside Station 7 Burgos Outside Station 4
Burgos Outside Station 9 Burgos Outside Station 4
##########

# Clean Sites 
selected_ff2_habitat_phi_sites <- ff2_habitat_phi_sites_management %>%
  select(
    name = location_name,
    latitude = mean_lat,
    longitude = mean_lon,
    management = location_status,
    country = country) %>%
  mutate(
    notes = NA,
    reef_type = NA,
    reef_zone = NA,
    exposure = NA) %>%
  filter(name != "NA")

# View Clean Sites
selected_ff2_habitat_phi_sites %>%
  kable(caption = "Table 8. Complete list of sites in the ff2_habitat dataset and required information") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 8. Complete list of sites in the ff2_habitat dataset and required information
name latitude longitude management country notes reef_type reef_zone exposure
Abiera MPA 11.579270 122.0859 Reserve Philippines NA NA NA NA
Agay-ayan 13.965345 123.4239 Reserve Philippines NA NA NA NA
Agay-ayan 13.965345 123.4239 Managed Access Philippines NA NA NA NA
Alegria MPA 10.062152 126.0673 Reserve Philippines NA NA NA NA
Alegria MPA Inside Station 1 10.062500 126.0667 Reserve Philippines NA NA NA NA
Alegria MPA Inside Station 2 10.061580 126.0683 Reserve Philippines NA NA NA NA
Bangaan 7.490918 122.4223 Reserve Philippines NA NA NA NA
Bangaan 7.490918 122.4223 Managed Access Philippines NA NA NA NA
Buluan 7.684789 122.5452 Reserve Philippines NA NA NA NA
Buluan 7.684789 122.5452 Managed Access Philippines NA NA NA NA
Buluan Island Marine Sanctuary 7.684789 122.5452 Reserve Philippines NA NA NA NA
Buluan Island Marine Sanctuary 7.684789 122.5452 Managed Access Philippines NA NA NA NA
Burgos MPA 10.023800 126.0748 Reserve Philippines NA NA NA NA
Burgos MPA Station 1 10.031710 126.0748 Reserve Philippines NA NA NA NA
Burgos MPA Station 2 10.023800 126.0748 Reserve Philippines NA NA NA NA
Burgos Outside Station 1 10.031710 126.0748 Managed Access Philippines NA NA NA NA
Burgos Outside Station 11 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 12 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 17 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 19 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 2 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 21 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 22 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 24 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 25 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 27 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 29 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 30 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 33 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 5 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 7 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Burgos Outside Station 9 10.026800 126.0742 Managed Access Philippines NA NA NA NA
Calmante Station 1 10.638690 124.4960 Managed Access Philippines NA NA NA NA
Calmante Station 2 10.639370 124.4980 Managed Access Philippines NA NA NA NA
Caloco 13.987414 123.4187 Reserve Philippines NA NA NA NA
Caloco 13.987414 123.4187 Managed Access Philippines NA NA NA NA
Caub MPA 9.901860 125.8848 Reserve Philippines NA NA NA NA
Caub MPA 9.901860 125.8848 Managed Access Philippines NA NA NA NA
Cloud 9 Station 1 9.825090 126.1535 Managed Access Philippines NA NA NA NA
Cloud 9 Station 2 9.814760 126.1605 Managed Access Philippines NA NA NA NA
Cloud 9 propose MPA 9.821192 126.1562 Propose MPA Philippines NA NA NA NA
Corregidor MPA 9.694080 126.0765 Reserve Philippines NA NA NA NA
Corregidor MPA 9.694080 126.0765 Managed Access Philippines NA NA NA NA
Daku Island 9.745700 126.1548 Managed Access Philippines NA NA NA NA
Daku Outside Station 1 9.745700 126.1548 Managed Access Philippines NA NA NA NA
Daku Outside Station 2 9.746540 126.1618 Managed Access Philippines NA NA NA NA
Dapdap MPA Station 1 10.790750 124.5216 Reserve Philippines NA NA NA NA
Dapdap MPA Station 2 10.790750 124.5216 Reserve Philippines NA NA NA NA
Diosan 7.630076 122.4950 Reserve Philippines NA NA NA NA
Duyong outside 11.721140 122.0271 Managed Access Philippines NA NA NA NA
Ermita 10.428043 123.4308 Reserve Philippines NA NA NA NA
Ermita 10.428043 123.4308 Managed Access Philippines NA NA NA NA
Gen Luna MPA 9.740430 126.1302 Reserve Philippines NA NA NA NA
General Luna MPA Station 1 9.740430 126.1302 Reserve Philippines NA NA NA NA
General Luna MPA Station 2 9.749000 126.1412 Reserve Philippines NA NA NA NA
Idiacacan MPA 11.679100 122.0985 Reserve Philippines NA NA NA NA
Idio MPA 11.628580 122.0956 Reserve Philippines NA NA NA NA
Iniban 9.888811 123.1488 Reserve Philippines NA NA NA NA
Iniban 9.888811 123.1488 Managed Access Philippines NA NA NA NA
Inusukan MPA Station 1 10.707170 124.4727 Reserve Philippines NA NA NA NA
Inusukan MPA Station 2 10.707170 124.4727 Reserve Philippines NA NA NA NA
Inusukan Outside Station 1 10.715490 124.4797 Managed Access Philippines NA NA NA NA
Inusukan Outside Station 2 10.715490 124.4797 Managed Access Philippines NA NA NA NA
Lampinigan 7.654517 123.0713 Reserve Philippines NA NA NA NA
Litayun MPA 7.440693 122.9767 Reserve Philippines NA NA NA NA
Litayun MPA 7.440693 122.9767 Managed Access Philippines NA NA NA NA
Mabini MPA Station 1 10.626090 124.4201 Reserve Philippines NA NA NA NA
Mabini MPA Station 2 10.626650 124.4164 Reserve Philippines NA NA NA NA
Mabini Station 3 10.625530 124.4292 Managed Access Philippines NA NA NA NA
Mabuhay Marine Park 7.410223 122.9474 Reserve Philippines NA NA NA NA
Mabuhay Marine Park 7.410223 122.9474 Managed Access Philippines NA NA NA NA
Mag-aba MPA 11.728670 122.0473 Reserve Philippines NA NA NA NA
Mantalip 9.796019 123.1651 Reserve Philippines NA NA NA NA
Mantalip 9.796019 123.1651 Managed Access Philippines NA NA NA NA
Maribojoc MPA 9.947448 126.3175 Reserve Philippines NA NA NA NA
Maribojoc MPA 9.947448 126.3175 Managed Access Philippines NA NA NA NA
Maribojoc MPA Station 1 9.947230 125.9551 Reserve Philippines NA NA NA NA
Maribojoc Outside Station 1 9.947830 126.9541 Managed Access Philippines NA NA NA NA
Moyong MPA 7.581733 123.0478 Reserve Philippines NA NA NA NA
Nag-Uban MPA 10.685620 124.3073 Reserve Philippines NA NA NA NA
PMP Inside 10.796760 124.5703 Reserve Philippines NA NA NA NA
PMP Outside 10.796740 124.5703 Managed Access Philippines NA NA NA NA
Pamosaingan MPA 9.684087 125.9125 Reserve Philippines NA NA NA NA
Pamosaingan MPA 9.684087 125.9125 Managed Access Philippines NA NA NA NA
Pamosaingan MPA Station 1 9.682040 125.9159 Reserve Philippines NA NA NA NA
Pamosaingan MPA Station 2 9.693230 125.9121 Reserve Philippines NA NA NA NA
Pamosaingan Outside Station 1 9.659140 125.9102 Managed Access Philippines NA NA NA NA
Pamosaingan Outside Station 2 9.703210 125.9130 Managed Access Philippines NA NA NA NA
Pandilosan Is. 7.461660 122.6918 Reserve Philippines NA NA NA NA
Patria MPA 11.732860 122.0140 Reserve Philippines NA NA NA NA
Pilar Poblacion MPA Station 1 9.860970 126.1006 Reserve Philippines NA NA NA NA
Pilar Poblacion MPA Station 2 9.859630 126.1034 Reserve Philippines NA NA NA NA
Pilar Salvacion MPA Station 1 9.853880 126.1104 Reserve Philippines NA NA NA NA
Pilar Salvacion MPA Station 2 9.853550 126.1081 Reserve Philippines NA NA NA NA
Poblacion MPA 9.860483 126.1016 Reserve Philippines NA NA NA NA
Pucio 11.757180 121.8518 Managed Access Philippines NA NA NA NA
Puertobello MPA 10.687850 124.4981 Reserve Philippines NA NA NA NA
Punta Manobo 7.776453 122.6977 Managed Access Philippines NA NA NA NA
Puntod Shoal MPA 11.607464 122.0182 Reserve Philippines NA NA NA NA
Salvacion MPA 9.853664 126.1089 Reserve Philippines NA NA NA NA
San Antonio 14.036126 123.3942 Managed Access Philippines NA NA NA NA
San Isidro MPA 10.614620 124.3548 Reserve Philippines NA NA NA NA
San Isidro Outside 10.614890 124.3607 Managed Access Philippines NA NA NA NA
San Juan 10.451897 123.4444 Reserve Philippines NA NA NA NA
San Juan 10.451897 123.4444 Managed Access Philippines NA NA NA NA
Sand Bar 7.537043 122.7259 Reserve Philippines NA NA NA NA
T. Arlan MPA 10.016519 126.0210 Reserve Philippines NA NA NA NA
T. Arlan MPA 10.016519 126.0210 Managed Access Philippines NA NA NA NA
T. Arlan MPA Inside Station 1 10.014060 126.0211 Reserve Philippines NA NA NA NA
T. Arlan MPA Outside Station 1 10.018870 126.0208 Managed Access Philippines NA NA NA NA
Takot Lawum 7.766900 122.6956 Managed Access Philippines NA NA NA NA
Takut Siare 7.426969 122.7732 Reserve Philippines NA NA NA NA
Takut Siare 7.426969 122.7732 Managed Access Philippines NA NA NA NA
Talisay MPA 9.964521 125.9856 Reserve Philippines NA NA NA NA
Talisay MPA 9.964521 125.9856 Managed Access Philippines NA NA NA NA
Talisay MPA Station 1 9.959450 125.9920 Reserve Philippines NA NA NA NA
Talisay Outside Station 1 9.970200 125.9785 Managed Access Philippines NA NA NA NA
Tambanan 7.308039 122.7999 Reserve Philippines NA NA NA NA
Tambanan 7.308039 122.7999 Managed Access Philippines NA NA NA NA
Tandu-Balasa 7.776790 122.7114 Reserve Philippines NA NA NA NA
Tingib MPA 11.728440 122.0458 Reserve Philippines NA NA NA NA
Tinigbas 11.754626 121.8655 Reserve Philippines NA NA NA NA
Tinigbas 11.754626 121.8655 Managed Access Philippines NA NA NA NA
Tuland Diot Station 1 10.719970 124.3146 Managed Access Philippines NA NA NA NA
Tuland Diot Station 2 10.719830 124.4839 Managed Access Philippines NA NA NA NA
Villahermosa MPA 10.670450 124.5166 Reserve Philippines NA NA NA NA

Missing Data on Required Fields (by Country)

1. Mozambique

# Filter country == "Mozambique"
ff2_habitat_moz <- ff2_habitat %>%
  filter(country == "Mozambique")

##########

#Count methodology 
ff2_habitat_moz_methodology <- ff2_habitat_moz %>%
  count(methodology)

# View methodology counts
ff2_habitat_moz_methodology %>%
  kable(caption = "Table 9. Methodology for the reef benthic community assessment") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 9. Methodology for the reef benthic community assessment
methodology n
NA 95
##########

## Reformat the data to match the MERMAID template

# Convert 'survey_date' to Date type
ff2_habitat_moz$surveydate <- as.Date(ff2_habitat_moz$surveydate)
# Create new columns for year, month, and day
ff2_habitat_moz <- ff2_habitat_moz %>%
  mutate(`Sample date: Year *` = year(surveydate),
         `Sample date: Month *` = month(surveydate),
         `Sample date: Day *` = day(surveydate))

# Column Site *
ff2_habitat_moz <- ff2_habitat_moz %>%
  rename(`Site *` = location_name)

# Column Management *
ff2_habitat_moz <- ff2_habitat_moz %>%
  rename(`Management *` = location_status)

# Column Transect number  *
ff2_habitat_moz <- ff2_habitat_moz %>%
  rename(`Transect number *` = transect_no)

# Column Depth *
ff2_habitat_moz <- ff2_habitat_moz %>%
  rename(`Depth *` = depth_m)

# Column Benthic attribute  *
ff2_habitat_moz <- ff2_habitat_moz %>%
  mutate(`Benthic attribute *` = case_when(
    is.na(genus) & is.na(species) ~ NA_character_,
    is.na(genus) ~ species,
    is.na(species) ~ genus,
    TRUE ~ paste(genus, species)
  ))

# Column Methodology
ff2_habitat_moz <- ff2_habitat_moz %>%
  rename(`Methodology *` = methodology)

selected_ff2_habitat_moz <- ff2_habitat_moz %>%
  select(
    "Methodology *",
    "Site *",
    "Management *",
    "Sample date: Year *",
    "Sample date: Month *",
    "Sample date: Day *",
    "Depth *",
    "Transect number *",
    "Benthic attribute *")

##########

## NAs counts in required fields:
na_counts_moz <- ff2_habitat_moz %>%
  summarise(
    `Management *` = sum(is.na(`Management *`)),
    `Sample date: Year *` = sum(is.na(`Sample date: Year *`)),
    `Sample date: Month *` = sum(is.na(`Sample date: Month *`)),
    `Sample date: Day *` = sum(is.na(`Sample date: Day *`)),
    `Depth *` = sum(is.na(`Depth *`)),
    `Transect number *` = sum(is.na(`Transect number *`)),
    `Benthic attribute *` = sum(is.na(`Benthic attribute *`))
  )

na_counts_moz %>%
  kable(caption = "Table 10. Counts of missing data in required fields") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 10. Counts of missing data in required fields
Management * Sample date: Year * Sample date: Month * Sample date: Day * Depth * Transect number * Benthic attribute *
0 0 0 0 95 0 95
##########

## Need to address: Methodology, Depth, Benthic Attribute !!! 

2. Honduras

# Filter country == "Honduras"
ff2_habitat_hon <- ff2_habitat %>%
  filter(country == "Honduras")

##########

#Count methodology 
ff2_habitat_hon_methodology <- ff2_habitat_hon %>%
  count(methodology)

# View methodology counts
ff2_habitat_hon_methodology %>%
  kable(caption = "Table 11. Methodology for the reef benthic community assessment") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 11. Methodology for the reef benthic community assessment
methodology n
photo transect 3231
NA 269
##########

## Reformat the data to match the MERMAID template

# Convert 'survey_date' to Date type
ff2_habitat_hon$surveydate <- as.Date(ff2_habitat_hon$surveydate)
# Create new columns for year, month, and day
ff2_habitat_hon <- ff2_habitat_hon %>%
  mutate(`Sample date: Year *` = year(surveydate),
         `Sample date: Month *` = month(surveydate),
         `Sample date: Day *` = day(surveydate))

# Column Site *
ff2_habitat_hon <- ff2_habitat_hon %>%
  rename(`Site *` = location_name)

# Column Management *
ff2_habitat_hon <- ff2_habitat_hon %>%
  rename(`Management *` = location_status)

# Column Transect number  *
ff2_habitat_hon <- ff2_habitat_hon %>%
  rename(`Transect number *` = transect_no)

# Column Depth *
ff2_habitat_hon <- ff2_habitat_hon %>%
  rename(`Depth *` = depth_m)

# Column Benthic attribute  *
ff2_habitat_hon <- ff2_habitat_hon %>%
  mutate(`Benthic attribute *` = case_when(
    is.na(genus) & is.na(species) ~ NA_character_,
    is.na(genus) ~ species,
    is.na(species) ~ genus,
    TRUE ~ paste(genus, species)
  ))

# Column Methodology
ff2_habitat_hon <- ff2_habitat_hon %>%
  rename(`Methodology *` = methodology)

selected_ff2_habitat_hon <- ff2_habitat_hon %>%
  select(
    "Methodology *",
    "Site *",
    "Management *",
    "Sample date: Year *",
    "Sample date: Month *",
    "Sample date: Day *",
    "Depth *",
    "Transect number *",
    "Benthic attribute *")

##########

## NAs counts in required fields:
na_counts_hon <- ff2_habitat_hon %>%
  summarise(
    `Management *` = sum(is.na(`Management *`)),
    `Sample date: Year *` = sum(is.na(`Sample date: Year *`)),
    `Sample date: Month *` = sum(is.na(`Sample date: Month *`)),
    `Sample date: Day *` = sum(is.na(`Sample date: Day *`)),
    `Depth *` = sum(is.na(`Depth *`)),
    `Transect number *` = sum(is.na(`Transect number *`)),
    `Benthic attribute *` = sum(is.na(`Benthic attribute *`))
  )

na_counts_hon %>%
  kable(caption = "Table 12. Counts of missing data in required fields") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 12. Counts of missing data in required fields
Management * Sample date: Year * Sample date: Month * Sample date: Day * Depth * Transect number * Benthic attribute *
0 1179 1179 1179 3500 0 1501
##########

## Need to address: Methodology, Date, Depth, Benthic Attribute !!! 

3. Indonesia

# Filter country == "Indonesia"
ff2_habitat_ind <- ff2_habitat %>%
  filter(country == "Indonesia")

##########

#Count methodology 
ff2_habitat_ind_methodology <- ff2_habitat_ind %>%
  count(methodology)

# View methodology counts
ff2_habitat_ind_methodology %>%
  kable(caption = "Table 13. Methodology for the reef benthic community assessment") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 13. Methodology for the reef benthic community assessment
methodology n
point 9999
##########

## Reformat the data to match the MERMAID template

# Convert 'survey_date' to Date type
ff2_habitat_ind$surveydate <- as.Date(ff2_habitat_ind$surveydate)
# Create new columns for year, month, and day
ff2_habitat_ind <- ff2_habitat_ind %>%
  mutate(`Sample date: Year *` = year(surveydate),
         `Sample date: Month *` = month(surveydate),
         `Sample date: Day *` = day(surveydate))

# Column Site *
ff2_habitat_ind <- ff2_habitat_ind %>%
  rename(`Site *` = location_name)

# Column Management *
ff2_habitat_ind <- ff2_habitat_ind %>%
  rename(`Management *` = location_status)

# Column Transect number  *
ff2_habitat_ind <- ff2_habitat_ind %>%
  rename(`Transect number *` = transect_no)

# Column Depth *
ff2_habitat_ind <- ff2_habitat_ind %>%
  rename(`Depth *` = depth_m)

# Column Benthic attribute  *
ff2_habitat_ind <- ff2_habitat_ind %>%
  mutate(`Benthic attribute *` = case_when(
    is.na(genus) & is.na(species) ~ NA_character_,
    is.na(genus) ~ species,
    is.na(species) ~ genus,
    TRUE ~ paste(genus, species)
  ))


# Column Methodology
ff2_habitat_ind <- ff2_habitat_ind %>%
  rename(`Methodology *` = methodology)

selected_ff2_habitat_ind <- ff2_habitat_ind %>%
  select(
    "Methodology *",
    "Site *",
    "Management *",
    "Sample date: Year *",
    "Sample date: Month *",
    "Sample date: Day *",
    "Depth *",
    "Transect number *",
    "old_attribute",
    "Benthic attribute *")

##########

## NAs counts in required fields:
na_counts_ind <- ff2_habitat_ind %>%
  summarise(
    `Management *` = sum(is.na(`Management *`)),
    `Sample date: Year *` = sum(is.na(`Sample date: Year *`)),
    `Sample date: Month *` = sum(is.na(`Sample date: Month *`)),
    `Sample date: Day *` = sum(is.na(`Sample date: Day *`)),
    `Depth *` = sum(is.na(`Depth *`)),
    `Transect number *` = sum(is.na(`Transect number *`)),
    `Benthic attribute *` = sum(is.na(`Benthic attribute *`))
  )

na_counts_ind %>%
  kable(caption = "Table 14. Counts of missing data in required fields") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 14. Counts of missing data in required fields
Management * Sample date: Year * Sample date: Month * Sample date: Day * Depth * Transect number * Benthic attribute *
0 0 0 0 9999 0 7074
##########

## Need to address: Depth, Benthic Attribute (can get some from old_attribute)!!! 

4. Philippines

# Filter country == "Philippines"
ff2_habitat_phi <- ff2_habitat %>%
  filter(country == "Philippines")

# Mutate n/a to NA
ff2_habitat_phi <- ff2_habitat_phi %>%
  mutate(across(where(is.character), ~na_if(.x, "n/a")))

##########

#Count methodology 
ff2_habitat_phi_methodology <- ff2_habitat_phi %>%
  count(methodology)

# View methodology counts
ff2_habitat_phi_methodology %>%
  kable(caption = "Table 15. Methodology for the reef benthic community assessment") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 15. Methodology for the reef benthic community assessment
methodology n
photo transect 999
NA 11126
##########

## Reformat the data to match the MERMAID template

# Convert 'survey_date' to Date type
ff2_habitat_phi$surveydate <- as.Date(ff2_habitat_phi$surveydate)
# Create new columns for year, month, and day
ff2_habitat_phi <- ff2_habitat_phi %>%
  mutate(`Sample date: Year *` = year(surveydate),
         `Sample date: Month *` = month(surveydate),
         `Sample date: Day *` = day(surveydate))

# Column Site *
ff2_habitat_phi <- ff2_habitat_phi %>%
  rename(`Site *` = location_name)

# Column Management *
ff2_habitat_phi <- ff2_habitat_phi %>%
  rename(`Management *` = location_status)

# Column Transect number  *
ff2_habitat_phi <- ff2_habitat_phi %>%
  rename(`Transect number *` = transect_no)

# Column Depth *
ff2_habitat_phi <- ff2_habitat_phi %>%
  rename(`Depth *` = depth_m)

# Column Benthic attribute  *
ff2_habitat_phi <- ff2_habitat_phi %>%
  mutate(`Benthic attribute *` = case_when(
    is.na(genus) & is.na(species) ~ NA_character_,
    is.na(genus) ~ species,
    is.na(species) ~ genus,
    TRUE ~ paste(genus, species)
  ))


# Column Methodology
ff2_habitat_phi <- ff2_habitat_phi %>%
  rename(`Methodology *` = methodology)

selected_ff2_habitat_phi <- ff2_habitat_phi %>%
  select(
    "Methodology *",
    "Site *",
    "Management *",
    "Sample date: Year *",
    "Sample date: Month *",
    "Sample date: Day *",
    "Depth *",
    "Transect number *",
    "old_attribute",
    "Benthic attribute *")

##########

## NAs counts in required fields:
na_counts_phi <- ff2_habitat_phi %>%
  summarise(
    `Management *` = sum(is.na(`Management *`)),
    `Sample date: Year *` = sum(is.na(`Sample date: Year *`)),
    `Sample date: Month *` = sum(is.na(`Sample date: Month *`)),
    `Sample date: Day *` = sum(is.na(`Sample date: Day *`)),
    `Depth *` = sum(is.na(`Depth *`)),
    `Transect number *` = sum(is.na(`Transect number *`)),
    `Benthic attribute *` = sum(is.na(`Benthic attribute *`))
  )

na_counts_phi %>%
  kable(caption = "Table 16. Counts of missing data in required fields") %>%
  kable_styling(bootstrap_options = "striped", full_width = FALSE)
Table 16. Counts of missing data in required fields
Management * Sample date: Year * Sample date: Month * Sample date: Day * Depth * Transect number * Benthic attribute *
60 196 196 196 3043 0 5644
##########

## Need to address: Management, Date, Depth, and Benthic Attribute (can get some from old_attribute)!!! 
# Exporting csv docs:


# Fields and Sites Mozambique
#write.csv(selected_ff2_habitat_moz_sites, "mermaid_sites_ff2_habitat_moz.csv", row.names = FALSE)
#write.csv(selected_ff2_habitat_moz, "mermaid_fields_ff2_habitat_moz.csv", row.names = FALSE)

# Fields and Sites Honduras
#write.csv(selected_ff2_habitat_hon_sites, "mermaid_sites_ff2_habitat_hon.csv", row.names = FALSE)
#write.csv(selected_ff2_habitat_hon, "mermaid_fields_ff2_habitat_hon.csv", row.names = FALSE)

# Fields and Sites Indonesia
#write.csv(selected_ff2_habitat_ind_sites, "mermaid_sites_ff2_habitat_ind.csv", row.names = FALSE)
#write.csv(selected_ff2_habitat_ind, "mermaid_fields_ff2_habitat_ind.csv", row.names = FALSE)

# Fields and Sites Philippines
#write.csv(selected_ff2_habitat_phi_sites, "mermaid_sites_ff2_habitat_phi.csv", row.names = FALSE)
#write.csv(selected_ff2_habitat_phi, "mermaid_fields_ff2_habitat_phi.csv", row.names = FALSE)