Smithsonian/rls2dwc

Name: rls2dwc

Owner: Smithsonian Institution

Description: MarineGEO Reef Life Survey to Darwin Core R package

Created: 2018-03-16 16:23:46.0

Updated: 2018-03-16 16:27:36.0

Pushed: 2018-03-16 16:27:35.0

Homepage: null

Size: 800

Language: R

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RLS2DWC - Reef Life Survey to Darwin Core R package

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

Installation
all.packages("devtools")
ools::install_github("Smithsonian/rls2dwc")
Example

Full example of processing a Reef Life Survey dataset

Workflow
Load RLS spreadsheet

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.

ata <- readRLS('example_data.xlsx', 'DATA')
Extract locations

Extracts the location data (SiteID, SiteName, decimalLatitude, decimalLongitude) from a reef life survey data set

tions <- uniqueSites(rlsdata)
Validate Species

Validate the scientific names using WoRMs and joins the results back to the original data

fy_sciName(rlsdata, dryrun=TRUE) # verify all unique scientific names against worms and report ones that don't have matches

x the scientific names
ata <- replace_sciName(rlsdata, "Acanthurus sp", "Acanthurus") %>% 
replace_sciName(rlsdata, "Scaridae sp.", "Scaridae") %>% 
replace_sciName(rlsdata, "Abudefduf sp.", "Abudefduf")


rify scientific names again 
 verify_sciName(rlsdata, dryrun=FALSE) #  non-matched names retained
Gather and make Unique IDs

Turns dataframe into a long format by gathering the abundances by size class.

thers observations into a long format (one size class per row) 
ong <- gather_measures(v)

d unique IDs for the events and the occurrences
ong_ids <- makeIDs(RLSlong)
Create Darwin Core tables

Generate the Event, Occurence and MeasurementOrFact tables.

t_table <- event(RLSlong_ids)
rence_table <- occurence(RLSlong_ids)
urementOrFact_table <- emof(RLSlong_ids)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.