-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add table and script associated with Albin et al. 1993 rec catch in CA
- Loading branch information
1 parent
2ada55d
commit 0f477e4
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
Data/Raw_not_confidential/yellowtail_rows_from_Albin_et_al_1993.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |