Converts a Reef life Survey spreadsheet to a R data frame and aligns the terms with Darwin Core terminology. The functions convert the reef life survey observations to a long tidy format and validates scientific names against the World Register of Marine Species. Exports the reef life survey data into several tables including Event, Occurrence and MeasurementOrFact
install.packages("devtools")
devtools::install_github("Smithsonian/rls2dwc")
Full example of processing a Reef Life Survey dataset
Loads a reef life survey excel datasheet as a R dataframe. Provide the path to the excel spreadsheet and the name of the tab that contains the data (usually called "DATA"). The function will load the spreadsheet, clean up the extra header info in the second row, combine the date and time field into one column, filter out empty data rows (Total=0), and add a source column using the filename provided.
rlsdata <- readRLS('example_data.xlsx', 'DATA')
Extracts the location data (SiteID, SiteName, decimalLatitude, decimalLongitude) from a reef life survey data set
locations <- uniqueSites(rlsdata)
Validate the scientific names using WoRMs and joins the results back to the original data
verify_sciName(rlsdata, dryrun=TRUE) # verify all unique scientific names against worms and report ones that don't have matches
# fix the scientific names
rlsdata <- replace_sciName(rlsdata, "Acanthurus sp", "Acanthurus") %>%
replace_sciName(rlsdata, "Scaridae sp.", "Scaridae") %>%
replace_sciName(rlsdata, "Abudefduf sp.", "Abudefduf")
# verify scientific names again
v <- verify_sciName(rlsdata, dryrun=FALSE) # non-matched names retained
Turns dataframe into a long format by gathering the abundances by size class.
# gathers observations into a long format (one size class per row)
RLSlong <- gather_measures(v)
# add unique IDs for the events and the occurrences
RLSlong_ids <- makeIDs(RLSlong)
Generate the Event, Occurence and MeasurementOrFact tables.
event_table <- event(RLSlong_ids)
occurence_table <- occurence(RLSlong_ids)
measurementOrFact_table <- emof(RLSlong_ids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.