VI Reef Resilience StudyOlinger et al. Coming Soon
(Any Others?)co-author suggestions welcome
2.2 Cross-reference benthic codes
Last updated
July 6, 2026
2.2 Cross-reference benthic codes
On this page
TCRMP, VINPS, and CSUN each name benthic taxa with their own codes. This page joins those three code sets into one cross-reference table so a single taxon carries one shared identity across all three programs. We read the TCRMP master code list and the VINPS taxon list, match them by scientific name (falling back to a code match), and pull the CSUN column names from the two CSUN benthic data sets. We then load the reviewed cross-reference, split each coral’s Meaning into genus and species, and write the joined table to outputs/s2pt2_benthicCoverCodes.csv. The final chunk saves benthicCoverXrefBenthicCodes.RData, the workspace that sections 2.3 through 2.10 load. This is a data-preparation page: it holds no time series, and it feeds the entire downstream benthic cover section.
Data sources
This page uses three program code lists: the TCRMP benthic-code master (TCRMP_benthicCodes_data.csv), the VINPS taxon table (VINPS_coverSpecificBenthicGroups_allSites_1999_2020_data.csv), and the CSUN column headers carried in the reformatted workspace from section 2.1. The joined cross-reference is finalized from the tracked file benthicCodes_crossref.csv, which carries the UAGA correction (VINPS records Agaricia agaricites under the code UAGA). The full cross-reference table is available to download below.
Load workspace and define variables
What happens here. We reopen the reformatted-data workspace from section 2.1, locate the most recent benthicCoverReformatData_<timestamp> folder so intermediate CSVs land beside the data they describe, and set the section tag s2pt2 that names every file this page writes.
Show code
# Load the previous workspaceload("benthicCoverReformatData.RData")# Function to find latest benthicCoverReformatData folderget_latest_data_folder<-function(){# List all directories in current folderall_dirs<-list.dirs(path =".", recursive =FALSE)# Filter for benthicCoverReformatData foldersdata_dirs<-grep("^\\./benthicCoverReformatData_\\d{8}_\\d{6}$", all_dirs, value =TRUE)if(length(data_dirs)==0){stop("No benthicCoverReformatData folders found!")}# Sort by name (which includes timestamp) and get the latestlatest_dir<-sort(data_dirs, decreasing =TRUE)[1]# Remove "./" from the startsub("^\\./", "", latest_dir)}# Get the latest data folder namebc_subfoldername<-get_latest_data_folder()# message("Using data folder: ", bc_subfoldername)section<-"s2pt2"
Load and process TCRMP benthic codes
We read the TCRMP master code list and drop the calculation rows (two spellings of the same label), keeping only the real benthic taxa and categories. A copy is written beside the reformatted data for provenance.
We read the VINPS taxon table and collapse it to one row per taxon, counting how often each taxon appears as prev. This gives a clean VINPS code list to match against the TCRMP taxa.
For each TCRMP taxon, we search the VINPS list first by scientific name and then, if that fails, by code, and we attach the matching VINPS row alongside the TCRMP row. The two halves keep tcrmp_ and vinps_ prefixes so their columns stay distinct in the joined table.
CSUN stores its taxa as column headers rather than as a code list. We pull those headers from the two CSUN benthic data sets (the random sites, and the original Yawzi and Tektite sites) and write each set out so the CSUN taxa can be matched into the cross-reference.
The automatic match above resolves most taxa, but a handful of program-specific naming quirks need a hand check. We finalize the cross-reference from the tracked, reviewed file benthicCodes_crossref.csv, committed with the repository so this page reproduces from versioned inputs. It carries the UAGA correction, and this loaded table is the canonical benthicCodes object that the rest of section 2 uses.
Show code
# Canonical, tracked cross-reference (carries the UAGA hand-correction). Committed with the# repository, so this page reproduces from versioned inputs, not a local working folder.benthicCodes<-read.csv("benthicCodes_crossref.csv", header =TRUE)
Note
Validation note. The finalized cross-reference holds 119 code rows across 12 columns. The UAGA correction is present: VINPS code UAGA (Undaria agaricites, a synonym of Agaricia agaricites) is mapped in the vinps_TaxonCode column, so VINPS Agaricia agaricites cover carries through the downstream sections rather than being silently dropped.
Add coral genus and species for more detailed coral look
For the coral rows, we split the TCRMP Meaning into a genus and a species so the later coral pages can group at either level. A few labels need small fixes: “Branching” corals are recorded as Porites, and the “Coral” and “Juvenile” placeholders become “unknown” and “unknown juv.”.
Table 1 shows how all three programs’ codes line up across every benthic group, not only corals. Each row is one taxon or benthic category with its TCRMP code, group, category, and meaning, the matched VINPS code and scientific name, and the CSUN column headers. Blank cells mark taxa that one program records and another does not. The table scrolls, and the full cross-reference is available to download above. It is a read-only view of the saved benthicCodes object and writes nothing.
Show code: build the full cross-reference table
# Read-only preview built AFTER the workspace is saved, so it never enters the saved RData.# local() keeps every helper binding out of the environment as well.local({full_xref<-benthicCodes[, c("tcrmp_Code", "tcrmp_Group", "tcrmp_Category", "tcrmp_Meaning","vinps_TaxonCode", "vinps_TaxonScientificName","csun_random_code", "csun_YZTK_code")]colnames(full_xref)<-c("TCRMP code", "TCRMP group", "TCRMP category", "TCRMP meaning","VINPS code", "VINPS scientific name", "CSUN random", "CSUN YZ/TK")kableExtra::kbl(full_xref, row.names =FALSE)|>kableExtra::kable_paper(full_width =FALSE)|>kableExtra::kable_styling(fixed_thead =TRUE, bootstrap_options =c("hover", "striped", "condensed"), font_size =9)|>kableExtra::scroll_box(width ="100%", height ="520px")})
Sec 2.2 Table 1: Full benthic cross-reference across the three monitoring programs. Each row is one taxon or benthic category, with its TCRMP code, group, category, and meaning, the matched VINPS code and scientific name, and the CSUN column headers. Blank cells mark taxa one program records and another does not.