From c474f48b73de9bd50f4042bf21f329692c7ebbe2 Mon Sep 17 00:00:00 2001 From: Sean Lucey Date: Thu, 30 Nov 2023 13:55:03 -0500 Subject: [PATCH] Added useLanded argument for foreign data --- R/get_comland_data.R | 2 +- R/process_foreign_data.R | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/get_comland_data.R b/R/get_comland_data.R index 6be2205..575bc01 100644 --- a/R/get_comland_data.R +++ b/R/get_comland_data.R @@ -96,7 +96,7 @@ get_comland_data <- function(channel, filterByYear = NA, #Pull data and process to look like comland data comland.foreign <- comlandr::get_foreign_data(filterByYear, filterByArea) comland.foreign <- comlandr::process_foreign_data(channel, comland.foreign, - useHerringMaine) + useLanded, useHerringMaine) #Combine foreign landings comland$comland <- data.table::rbindlist(list(comland$comland, comland.foreign), diff --git a/R/process_foreign_data.R b/R/process_foreign_data.R index e7d166d..041b5cc 100644 --- a/R/process_foreign_data.R +++ b/R/process_foreign_data.R @@ -22,7 +22,7 @@ #' #'@export -process_foreign_data <- function(channel, nafoland, useHerringMaine){ +process_foreign_data <- function(channel, nafoland, useLanded = T, useHerringMaine = T){ ## All code copied directly from nafo_comland nafoland <- nafoland[Divcode %in% c(47, 51:56, 61:63) & Code > 3, ] @@ -116,6 +116,9 @@ process_foreign_data <- function(channel, nafoland, useHerringMaine){ #remove species without a match nafoland <- nafoland[!is.na(NESPP3), ] + #Convert scallops to meat weight + if(useLanded) nafoland[NESPP3 == 800, SPPLIVMT := SPPLIVMT / 8.33], ] + #Remove herring catch - if pulling using comlandr::get_herring_data() if(useHerringMaine) nafoland <- nafoland[NESPP3 != 168, ]