diff --git a/Data/Raw_not_confidential/yellowtail_rows_from_Albin_et_al_1993.csv b/Data/Raw_not_confidential/yellowtail_rows_from_Albin_et_al_1993.csv new file mode 100644 index 0000000..164b626 --- /dev/null +++ b/Data/Raw_not_confidential/yellowtail_rows_from_Albin_et_al_1993.csv @@ -0,0 +1,9 @@ +Yellowtail Rockfish rows from Albin et al. 1993 (EFFORT AND CATCH ESTIMATES FOR NORTHERN AND CENTRAL CALIFORNIA MARINE RECREATIONAL FISHERIES, 1981-1986) +,,Del Norte / Humboldt,Del Norte / Humboldt,Del Norte / Humboldt,Mondocino / Sonoma,Mondocino / Sonoma,Mondocino / Sonoma,San Francisco,San Francisco,San Francisco,Santa Cruz / Monterey,Santa Cruz / Monterey,Santa Cruz / Monterey,San Luis Obispo,San Luis Obispo,San Luis Obispo,Total,Total,Total +Table,Year,Est,SE,CV,Est,SE,CV,Est,SE,CV,Est,SE,CV,Est,SE,CV,Est,SE,CV +Table 1 page 11 (15 of PDF),1981,0,0,61,66,19,29,104,46,44,46,19,41,53,29,55,269,61,22 +Table 1 page 59 (63 of PDF),1982,2,2,100,135,168,125,88,38,41,362,266,74,84,63,74,671,323,48 +Table 1 page 107 (111 of PDF),1983,2,2,116,85,47,56,113,40,35,126,37,29,36,31,87,362,79,22 +Table 1 page 155 (159 of PDF),1984,25,32,124,110,34,31,80,43,53,117,26,22,80,61,76,413,91,22 +Table 1 page 203 (207 of PDF),1985,16,14,87,62,9,14,175,51,29,108,27,25,152,105,69,513,121,24 +Table 1 page 251 (255 of PDF),1986,8,9,124,37,8,21,154,40,26,114,38,34,69,57,84,381,81,21 \ No newline at end of file diff --git a/Rscripts/albin_ratio.R b/Rscripts/albin_ratio.R new file mode 100644 index 0000000..5f7f6a8 --- /dev/null +++ b/Rscripts/albin_ratio.R @@ -0,0 +1,45 @@ +# csv contains the Yellowtail Rockfish rows form the 6 year-specific Tables 1 in +# Albin et al. 1993 which contains county-specific catch estimates for 1981-1986 +# +# CSV file matches format of the this file used for Lingcod in 2021: +# https://github.com/pfmc-assessments/lingcod/blob/main/data-raw/Albin_et_al_1993_Lingcod_rows.csv +# and code below is adapted from Kelli Johnson's code at +# https://github.com/pfmc-assessments/lingcod/blob/main/doc/catch.Rmd#L761-L855 +# The numbers in the Albin et al. PDF were initially copied to +# https://docs.google.com/spreadsheets/d/1xAeGBCw-xz1UaFx38A9tQvSzdY4kzi5p4aWCl7XJP28/edit?gid=0#gid=0 +# and QA/QC'd in that sheet + +file_albin <- 'data/Raw_not_confidential/yellowtail_rows_from_Albin_et_al_1993.csv' +data_albin <- read.csv(file = file_albin, + skip = 2, header = TRUE, check.names = FALSE +) %>% + rlang::set_names(paste(sep = "_", + read.csv( + file = file_albin, + skip = 1, header = FALSE, check.names = FALSE, nrows = 1 + ), + colnames(.)) + ) %>% + dplyr::select(-NA_Table) |> + dplyr::rename(Year = "NA_Year") %>% + tidyr::gather("type", "value", -Year) %>% + tidyr::separate(type, into = c("Area", "type"), sep = "_") %>% + tidyr::spread(key = "type", value = "value") %>% + dplyr::arrange(Area) %>% + dplyr::mutate(Source = "albinetal1993") %>% + dplyr::filter(Area != "Total") %>% + dplyr::group_by(Year) %>% + dplyr::mutate(sum = sum(Est)) %>% + dplyr::group_by(Area, Year) %>% + dplyr::mutate(prop_source = Est / sum) %>% + dplyr::ungroup() + +albinmeanpropN <- data_albin %>% + dplyr::group_by(Year) %>% + dplyr::mutate(YearT = sum(Est)) %>% + dplyr::ungroup() %>% dplyr::group_by(Area) %>% + dplyr::summarize(wm = stats::weighted.mean(prop_source, w = YearT)) %>% + dplyr::filter(grepl("Del", Area)) %>% dplyr::pull(wm) + +albinmeanpropN +# [1] 0.0203143 \ No newline at end of file