diff --git a/2024/R/BIN_AGE_DATA.r b/2024/R/BIN_AGE_DATA.r new file mode 100644 index 0000000..c5ab8aa --- /dev/null +++ b/2024/R/BIN_AGE_DATA.r @@ -0,0 +1,17 @@ +# adapted/generalized from Steve Barbeaux' files for +# generating SS files for EBS/AI Greenland Turbot +# ZTA, 2013-05-08, R version 2.15.1, 32-bit + +BIN_AGE_DATA <- function(data,age_bins=seq(1,100,1)) +{ + age<-data.frame(AGE=c(1:max(data$AGE))) + age$aBIN<-max(age_bins) + n<-length(age_bins) + for(i in 2:n-1) + { + age$aBIN[age$AGE < age_bins[((n-i)+1)] ]<-age_bins[n-i] + } + data<-merge(data,age,all.x=T,all.y=F) + data +} + diff --git a/2024/R/BIN_LEN_DATA.r b/2024/R/BIN_LEN_DATA.r new file mode 100644 index 0000000..777c601 --- /dev/null +++ b/2024/R/BIN_LEN_DATA.r @@ -0,0 +1,17 @@ +# adapted/generalized from Steve Barbeaux' files for +# generating SS files for EBS/AI Greenland Turbot +# ZTA, 2013-05-08, R version 2.15.1, 32-bit + +BIN_LEN_DATA <- function(data,len_bins=seq(1,100,1)) +{ + length<-data.frame(LENGTH=c(1:max(data$LENGTH))) + length$BIN<-max(len_bins) + n<-length(len_bins) + for(i in 2:n-1) + { + length$BIN[length$LENGTH < len_bins[((n-i)+1)] ]<-len_bins[n-i] + } + data<-merge(data,length,all.x=T,all.y=F) + data +} + diff --git a/2024/R/old_fishery_lcomp_routine.R b/2024/R/old_fishery_lcomp_routine.R index e9ae4cd..fb89be3 100644 --- a/2024/R/old_fishery_lcomp_routine.R +++ b/2024/R/old_fishery_lcomp_routine.R @@ -17,9 +17,8 @@ username_AKFIN <- showPrompt(title="Username", message="Enter your AKFIN usernam password_AKFIN <- askForPassword(prompt="Enter your AKFIN password:") AKFIN <- odbcConnect("AKFIN",username_AKFIN,password_AKFIN, believeNRows = FALSE) - -source("C:/USERS/MAIA.KAPUR/WORK/ASSESSMENTS/NEWSBSS/FUNCTIONS/BIN_LEN_DATA.R") -source("C:/USERS/MAIA.KAPUR/WORK/ASSESSMENTS/NEWSBSS/FUNCTIONS/BIN_AGE_DATA.R") +source(here::here(year,'R','BIN_LEN_DATA.R')) +source(here::here(year,'R','BIN_AGE_DATA.R')) ## Flathead sole only = 103, Rex = 105, Dover = 107, Bering flounder = 145, GT = 102, Deepsea sole = 110 ## Setup options for flathead sole in BSAI final_year <- 2024