You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
removeBrokenSpeciesListLinks filter not working properly #59
library(icesRDBES)
# Get some test data - if you get errors or an emptry object check your wd
myLohr <- importRDBESDownloadData('data-raw/WGRDBES-EST_TEST_LOHR_eg_3_2_3_6.zip')
# Test 1) removeBrokenSpeciesListLinks() works ok - it doesn't remove any SS rows valid data
# Check number of SS rows before removing broken species list links (300)
nrow(myLohr[["SS"]])
# Try removing any broken links
test1 <- removeBrokenSpeciesListLinks(myLohr)
# Check number of SS rows after removing broken species list links - no broken links so shoudl be the same (300)
nrow(test1[["SS"]])
# Test 2) removeBrokenSpeciesListLinks() works ok. Let's try removing all species lists from SL and check all SS rows are removed.
test2 <- filterRDBESDataObject(myLohr,c("SLspeclistName"),c("xxx"))
# Check number of SS rows before removing broken species list links (300)
nrow(test2[["SS"]])
# Try removing any broken links
test3 <- removeBrokenSpeciesListLinks(test2)
# Check number of SS rows after removing broken species list links - we've removed all SL rows so all SS entries shoudl be broken - number of SS rows shoudl now be zero - it is :-)
nrow(test3[["SS"]])
# Test 3) removeBrokenSpeciesListLinks() does not work correctly. Change all SL entries to relate to "Dis" rather than "Lan" - the current removeBrokenSpeciesListLinks() function thinks everything is ok so doesn't remove any SS rows - however the correct behaviour should be to remove all SS rows
test4 <- myLohr
test4[["SL"]]$SLcatchFrac <- "Dis"
# Note that all SS rows are Lan but all SL rows are Dis - we now have a mis-match between SL and SS
unique(test4[["SS"]]$SScatchFra)
unique(test4[["SL"]]$SLcatchFrac)
# Check number of SS rows before removing broken species list links (300)
nrow(test4[["SS"]])
# Try removing any broken links
test5 <- removeBrokenSpeciesListLinks(test4)
# Check number of SS rows after removing broken species list links - we shoudl have zero rows because we don't have an SL entry that matches on Species List Name, catch fraction, country, and year - however we still have 300 rows :-(
nrow(test5[["SS"]])
Activity
[-]removeBrokenSpeciesListLinks[/-][+]removeBrokenSpeciesListLinks filter not working properly[/+]davidcurrie2001 commentedon Oct 13, 2022
I will create an example
davidcurrie2001 commentedon Oct 13, 2022
nicholascarey commentedon Oct 19, 2023
Revised and should be working now but needs tested.
rix133 commentedon Oct 14, 2024
test-removeBrokenSpeciesListLinks needs the 4 use cases see above implemented as tests