Welcome! This guide will help you navigate the dataset and start your analysis.
How do cryptic invertebrates (CAFI) affect coral reef ecosystems?
Use these files:
maatea_size_cafi_taxonomy_merged_2019_2021_v2.csv (8,965 invertebrates)mrb_amount_cafi_field_experiment_summer_2021_v4.csv (4,119 invertebrates)moorea_survey_cafi_taxonomy_summer_2019_v5.csv (3,989 invertebrates)Key columns:
family, genus, species - Taxonomic identificationcafi_size_mm - Original size (may include “<5”, “L”, “M”)cafi_size_mm_numeric - Numeric-only for analysiscoral_id - Links to coral colonytime_point - When sampled (initial/intermediate/final)Use these files:
mrb_amount_coral_growth_surface_area_change_v1.csv (54 corals)mrb_amount_photogrammetry_measures_2019_2021_v1.csv (108 measurements)Key columns:
delta_surface_area - Change in coral surface area (cm²)delta_max_height - Change in max height (cm)coral_id - Colony identifierUse these files:
maatea_size_physiology_master_long_2019_2021_v3.csv (118 samples)mrb_amount_physiology_master_2019_2021_v5.csv (53 samples)moorea_survey_physiology_master_2019_v3.csv (108 samples)Key columns:
protein_mg_cm2 - Tissue protein contentcarb_mg_cm2 - Carbohydrate contentzoox_cells_cm2 - Zooxanthellae densitysurface_area - Coral surface areaUse these files:
maatea_size_fish_surveys_2019_2021_v1.csv (4,581 observations)mrb_amount_fish_surveys_may_2021_v1.csv (999 observations)Key columns:
family, genus, species - Fish taxonomycount - Number observedcafi_size_mm - Fish size# Set working directory
setwd("path/to/Moorea_Coral_CAFI_Data")
# Load CAFI data
cafi <- read.csv("data/maatea_size_cafi_taxonomy_merged_2019_2021_v2.csv")
# Check structure
str(cafi)
head(cafi)
# Summary statistics
summary(cafi$cafi_size_mm_numeric) # Use _numeric for calculations
import pandas as pd
import os
# Set working directory
os.chdir("path/to/Moorea_Coral_CAFI_Data")
# Load CAFI data
cafi = pd.read_csv("data/maatea_size_cafi_taxonomy_merged_2019_2021_v2.csv")
# Check structure
print(cafi.info())
print(cafi.head())
# Summary statistics
print(cafi['cafi_size_mm_numeric'].describe()) # Use _numeric for calculations
Field data often includes non-numeric values that carry meaning:
<5 = “too small to measure precisely, less than 5mm”L, M, S = size categoriesWe provide both columns:
cafi_size_mm):
cafi_size_mm_numeric):
# View original data
cafi$cafi_size_mm
# [1] "8.5" "<5" "L" "12.3" "6.1" "<1"
# Calculate mean (use numeric column)
mean(cafi$cafi_size_mm_numeric, na.rm = TRUE)
# [1] 8.97
# How many were too small to measure?
sum(cafi$cafi_size_mm == "<5", na.rm = TRUE)
# [1] 234
coral_id - Links everything to a specific coral colony
SITE-POC## (e.g., MAT-POC01, MRB-POC45)time_point - Links to sampling time
initial, intermediate, finaldate - Links to specific date
library(dplyr)
# Load data
cafi <- read.csv("data/maatea_size_cafi_taxonomy_merged_2019_2021_v2.csv")
phys <- read.csv("data/maatea_size_physiology_master_long_2019_2021_v3.csv")
# Count CAFI per colony
cafi_counts <- cafi %>%
group_by(coral_id) %>%
summarize(total_cafi = n())
# Merge
merged <- phys %>%
left_join(cafi_counts, by = "coral_id")
# Analyze
plot(merged$total_cafi, merged$protein_mg_cm2)
NA - Not available. - Sometimes used# Remove NA values
cafi_clean <- cafi[!is.na(cafi$cafi_size_mm_numeric), ]
# Or use na.rm in functions
mean(cafi$cafi_size_mm_numeric, na.rm = TRUE)
# Remove NA values
cafi_clean = cafi.dropna(subset=['cafi_size_mm_numeric'])
# Or use skipna in functions
cafi['cafi_size_mm_numeric'].mean(skipna=True)
# ❌ WRONG - will error on non-numeric values
mean(cafi$cafi_size_mm)
# Error: argument is not numeric or logical
# ✅ CORRECT - use _numeric column
mean(cafi$cafi_size_mm_numeric, na.rm = TRUE)
# ❌ WRONG - treats as missing
cafi_clean <- cafi[!is.na(cafi$cafi_size_mm_numeric), ]
# Lost 234 observations that were recorded as "<5"!
# ✅ CORRECT - analyze separately or impute
small_cafi <- cafi[cafi$cafi_size_mm == "<5", ]
nrow(small_cafi) # 234 - these are real observations!
# ❌ WRONG - will create duplicates
merged <- left_join(cafi, phys, by = "coral_id")
# Problem: Multiple CAFI per coral, wrong matches!
# ✅ CORRECT - aggregate first
cafi_summary <- cafi %>%
group_by(coral_id, time_point) %>%
summarize(cafi_count = n())
merged <- left_join(phys, cafi_summary, by = c("coral_id", "time_point"))
metadata/README_*_project_overview.docx - Experimental overviewmetadata/README_*_cafi_metadata_v*.xlsx - CAFI column descriptionsmetadata/README_*_phys_metadata_v*.xlsx - Physiology methodsDATA_DICTIONARY.md - All column descriptionslibrary(dplyr)
library(ggplot2)
# Load data
cafi <- read.csv("data/maatea_size_cafi_taxonomy_merged_2019_2021_v2.csv")
sizes <- read.csv("data/maatea_size_colony_measurements_wide_2019_2021_v1.csv")
# Calculate diversity per colony
diversity <- cafi %>%
group_by(coral_id) %>%
summarize(
richness = n_distinct(family, na.rm = TRUE),
abundance = n()
)
# Merge with size data
merged <- left_join(diversity, sizes, by = "coral_id")
# Plot
ggplot(merged, aes(x = sa_june_cm2, y = richness)) +
geom_point() +
geom_smooth(method = "lm") +
labs(x = "Coral Surface Area (cm²)",
y = "CAFI Family Richness",
title = "CAFI Diversity Increases with Coral Size")
library(dplyr)
library(ggplot2)
# Load data
growth <- read.csv("data/mrb_amount_coral_growth_surface_area_change_v1.csv")
treatments <- read.csv("data/mrb_amount_experimental_treatments_v1.csv")
# Merge
merged <- left_join(growth, treatments, by = "coral_id")
# Summary by treatment
summary_stats <- merged %>%
group_by(treatment) %>%
summarize(
mean_growth = mean(delta_surface_area, na.rm = TRUE),
se = sd(delta_surface_area, na.rm = TRUE) / sqrt(n()),
n = n()
)
# Plot
ggplot(summary_stats, aes(x = treatment, y = mean_growth)) +
geom_bar(stat = "identity") +
geom_errorbar(aes(ymin = mean_growth - se, ymax = mean_growth + se), width = 0.2) +
labs(x = "CAFI Removal Treatment",
y = "Change in Surface Area (cm²)",
title = "Effect of CAFI Removal on Coral Growth")
library(dplyr)
library(ggplot2)
# Load data
cafi <- read.csv("data/moorea_survey_cafi_taxonomy_summer_2019_v5.csv")
# Top 10 families
top_families <- cafi %>%
filter(!is.na(family)) %>%
count(family, sort = TRUE) %>%
head(10)
# Plot
ggplot(top_families, aes(x = reorder(family, n), y = n)) +
geom_bar(stat = "identity") +
coord_flip() +
labs(x = "Family",
y = "Count",
title = "Top 10 CAFI Families in Mo'orea Survey")
All study site coordinates are provided in metadata/site_locations.csv
Example - Load in R:
sites <- read.csv("metadata/site_locations.csv")
head(sites)
# MRB site: -17.476703, -149.813681
# Maatea site: -17.599607, -149.808107
Team information is in metadata/personnel.csv
Principal Investigators:
Field Team:
metadata/ folder - 5 .txt method overviews + 9 .xlsx data dictionariesHappy analyzing! 🐠🪸