diff --git a/R/plot_recruitment.R b/R/plot_recruitment.R index a4be6280..19aa6149 100644 --- a/R/plot_recruitment.R +++ b/R/plot_recruitment.R @@ -51,7 +51,7 @@ plot_recruitment <- function( # Extract recruitment prepared_data <- filter_data( dat = dat, - label_name = "recruitment$", # might need to adjust for expected vs predicted rec + label_name = "recruitment$", geom = "line", era = era, group = group, diff --git a/inst/WORDLIST b/inst/WORDLIST index ee011d55..9cef7441 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,23 +1,32 @@ BAM BMSY Barbeaux +Beringraja Birthseason +Bizzarro CPUE Carvalho Dorn +EffN FIMS FLIMIT FMSY FTARGET Fmort +GenSI +Gertseva Hennen Holsman Ianelli +Jeffreys Lifecycle MSY +McAllister Modelling +Mohn's NOAA ORCID +OST Petrale Pre Preformatted @@ -25,31 +34,24 @@ Rceattle Rda Rmarkdown Rmd +SDNR SEDAR SPR Spawners StockSmart Subseason -aa -agedbase +WCGBTS +Wolfowitz al alttext asar assmt -BAM bam -Beringraja -bigskate binoculata birthseas -Birthseason -Bizzarro -BMSY -caal cha cmd conjuction -CPUE csv customizations cv @@ -57,84 +59,47 @@ dat dataframe's diagonostic dplyr -EffN et facetting -FIMS fims flextable -FLIMIT -Fmort -FMSY -FTARGET -GenSI -Gertseva getwd ggplot gp -Hennen hline href -Ianelli is’ -Jeffreys kableExtra kobe len -lencomp -lendbase -Lifecycle loess -McAllister -Mohn's -mohn's mis -Modelling -MSY misspecification msy natively -NOAA noaa -Nsamp nsim -obsvpred -ORCID -OST pearson -Petrale pkgdown -Pre -Preformatted preformatted preselected qq -Rceattle rceattle -Rda rda -rds rda's rdat -Rmarkdown -Rmd +rds rowid satf sd -SDNR se seealso socio -Spawners -SPR +spr ss -SSMethod sso -stddev -StockSmart str stringr -Subseason subseason tbl theming @@ -144,7 +109,5 @@ tibbles tidyr tidyselect unfished -WCGBTS -Wolfowitz yaml yml diff --git a/vignettes/convert_output_details.Rmd b/vignettes/convert_output_details.Rmd index dd3b10f2..e5723546 100644 --- a/vignettes/convert_output_details.Rmd +++ b/vignettes/convert_output_details.Rmd @@ -46,14 +46,12 @@ The converter manipulates data sets by recognizing patterns based on the assessm The data is manipulated to follow the format in @tbl-cols. The majority of the code in the function is specific for how one would manipulate the output with the following exceptions. The code in the converter creates an empty data frame with the columns referenced in @tbl-cols (See [code](https://github.com/nmfs-ost/stockplotr/blob/c8db61f325e9926461c70ef2d62349eb8d2bf2dd/R/convert_output.R#L45-L81)). At the end of the function, standard naming conventions are applied to rename labels of parameters or quantities as followed in @sec-namecon. Currently, we have files to use as examples to change the names of labels following our convention. One of the example files can be downloaded [here](https://github.com/nmfs-ost/stockplotr/blob/main/inst/resources/ss3_var_names.xlsx). The final data frame is exported to the user's environment as an object, if it is assigned an object name (e.g., `my_converted_output <- convert_output(...)`). - ```{r, echo=TRUE} #| eval: false load("example_conout.rda") head(hake_conout) ``` - The data frame is structured in following the convention of FIMS but removing the use of S4 or S3 data frame classes encouraging a more user friendly set up to start. The following format outlines the standard data frame: | Column label | Description | @@ -156,6 +154,45 @@ The final data frame does not manipulate column typing (character, numeric, etc. In conclusion, the final data frame should be very long with repeating years and factors to represent each point of data from the output file. Some metrics such as estimated stock-recruitment curve, weight-length relationship or other similar parameters are not currently in this function. There are also a number of "keywords" found in the SS3 Report.sso file that are not in the converted output file. We plan to update this in the future, but we prioritized the converter to contain information for plotting. +## Standard naming in Functions + +The following is a list of standard naming conventions used in the functions within the {stockplotr} package. These names correspond to the labels being searched for in the standard data format that each plotting function expects from the converted output data frame. Many of these strings are regular expressions meaning if they begin with "^", they are searching for the start of the string. If they end with "$", they are searching for the end of the string. If the string starts with "^" and ends with "$", it is searching for an exact match of the entire string. For exact names, please refer to any of the example output "label" columns found in the package (vermilion_snapper, ss3_simple, or cod). + +- `plot_abundance_at_age()` : "abundance" +- `plot_age_to_length_conversion()` : "age_to_length_conversion" +- `plot_biomass_at_age()` : "biomass" +- `plot_biomass()` : "biomass_biomass_unfished|biomass_ratio", "^biomass$" -- depends on wanting relative values +- `plot_catch_at_age()` : "catch|landings" (whatever variation of this is available -- typically only one because we are looking at only catch with age) +- `plot_composition()`/`plot_composition_diagnostics()` : +[1] "length_composition_observed" +[2] "length_composition_predicted" +[3] "length_composition_pearson_residual" +[4] "length_composition_sample_size" +[5] "age_composition_observed" +[6] "age_composition_predicted" +[7] "age_composition_pearson_residual" +[8] "age_composition_sample_size" +- `plot_data_availability()` : see function data_availability in the file plot_data_availability.R +- `plot_discard()` : "^discard" -- fits are ^discard_(observed|predicted)$" +- `plot_fishing_mortality()` : "\^fishing_mortality\$" +- `plot_index()` : "\^index\_(observed\|predicted)\$" +- `plot_joint_residuals()` : "\^index\_(observed\|predicted)\$" +- `plot_landings()` : "catch", "catch_predicted", "landings_observed", "landings_observed_weight", "landings_observed_numbers", "catch_predicted", "landings" +- `plot_natural_mortality()` : "natural_mortality" +- `plot_recruitment_deviations()` : "recruitment_deviations" +- `plot_recruitment()` : "recruitment\$", "predicted_recruitment", "expected_recruitment" +- `plot_retrospective()` : Inherits naming from plot_biomass(), plot_spawning_biomass(), plot_fishing_mortality(), plot_recruitment(), or plot_spr() +- `plot_runs_test()` : "\^index\_(observed\|predicted)\$" +- `plot_selectivity()` : "selectivity" +- `plot_spawning_biomass()`: "spawning_biomass_spawning_biomass_{ref_line}", "spawning_biomass_ratio", "^spawning_biomass$" +- `plot_spr()`: "spr" +- `plot_stock_recruitment()`: "recruitment" +- `table_biomass_abundance_catch()`: "^biomass\$", "^abundance", "catch$", "landings_observed" +- `table_index()`: "index_observed", "index_predicted" +- `table_landings()`: "landings_observed", "landings_observed_weight", "landings_observed_numbers", "catch_predicted", "catch" +- `table_projections()`: "^catch\$", "^landings_weight\$", "^spawning_biomass\$", "^fishing_mortality\$" +- `table_total_catch()`: "^catch" + ## Helpful Functions to Manipulate Data The following functions were used in the [`convert_output()`](https://github.com/nmfs-ost/stockplotr/blob/main/R/convert_output.R) function that could be helpful for users replicating it for other assessment models: