ices-tools-dev / RDBEScore

Provides functions to work with the Regional Database & Estimation System (RDBES)
https://ices-tools-dev.github.io/RDBEScore/
GNU General Public License v3.0
0 stars 4 forks source link

Append species information to RDBES data #141

Open davidcurrie2001 opened 1 year ago

davidcurrie2001 commented 1 year ago

Users find it difficult to understand aphia ids but these are the only mandatory species information available in the RDBES. Can we append useful species information such as scientific name/common name to our RDBES data.

KirstenBirchHaakansson commented 1 year ago

I think it would be relativity simple to add scientific name, but not so straight forward with common name / FAO.

So a function for adding species information and as a start scientific name

davidcurrie2001 commented 1 year ago

Related issues have been opened: #146 #147

davidcurrie2001 commented 1 year ago

Example of adding scientific name to SA using the ICES Worms code list:

# Load some RDBES data
myObject <- createRDBESDataObject(input = "./tests/testthat/h1_v_1_19_18")
# Append ICES specWorms code list to SA data
# (the "Description" column contains the scientific name)
saWithSpecWorms <- dplyr::left_join(myObject[["SA"]],
                                    RDBEScore::icesSpecWoRMS,
                                    by=c("SAspeCode"="Key"))
davidcurrie2001 commented 1 year ago

Example of adding scientific name to SA using the Aphia records from WoRMS:

# Load some RDBES data
myObject <- createRDBESDataObject(input = "./tests/testthat/h1_v_1_19_18")
aphiaRecords <- RDBEScore::wormsAphiaRecord
# Change the AphiaID to a char (so it is easier to join to the RDBES speCode field)
aphiaRecords$AphiaID <- as.character(aphiaRecords$AphiaID)
# Append ahpia records to SA data
# (the "scientificname" column contains the scientific name)
saWithAphiaID <- dplyr::left_join(myObject[["SA"]],
                                    aphiaRecords,
                                    by=c("SAspeCode"="AphiaID"))