Skip to content

Releases: nwfsc-math-bio/NWCTrends

v1.30 NWCTrends

03 Jun 01:31
31145ab
Compare
Choose a tag to compare

Changes since version 1.26 (2020 Viability Report)

Tables

  • Raw geomeans captions updated to clarify that the number of years in the wild geomeans could be different than for the total geomeans because there may be years with missing fraction wild.
  • Raw geomeans captions have been updated to clarify how 0s in the data are dealt with. They are replaced with NA. The methods vignette has been updated to include a section on how 0s are dealt with and misspellings corrected.

Output

  • Altered productivity_fig.R to output the data for the figure as a csv file.
  • Added show.all.fracwild to NWCTrends_report() so that that can be changed from the main function.

Plots

  • I revamped how to customize plots and palettes. I no longer use nwctrends.palette. Instead I use pkg_globals in the package environment. The user passes in nwctrends.options as a list with any of the plot options that they want to update (e.g. line color or line type or point type). See the new onLoad.R file and the nwctrends_options.R file. Note .onLoad() is run whether the package is loaded via library() or via NWCTrends::.
  • Added a data object nwctrends.pallete with red, blue, black, green and white defined (in a list). To change the colors, the user a new palette list to NWCTrends()

Vignettes and examples

  • I was overloading the inst/doc folder with non-vignette material. I moved the needed report files (Rmd and tex) to inst/report_files and the demo data to inst/extdata. The inst/doc folder now only has the two vignettes and the documentation PDFs.
  • I also updated the vignettes folder such that if install_local() or install_github() with build_vignettes=TRUE is used, the inst/doc created will match that on GitHub. Note, the user would have to accept inst/doc will be deleted. It doesn't delete the files in the repo, just re-creates inst/doc in the installed version in the user library.
  • I added a file local_build_instructions.txt to the repo to remind me how to build the vignettes and how to deal with devtools::check() deleting the inst/doc folder.
    • Added some examples to NWCTrends_report.R.

Version 1.25 2020 Status Review

05 Jul 03:14
Compare
Choose a tag to compare

This the version of NWCTrends used in the 2020 Status Review.

Some notes for trend document 2020 versus 2015.

In 2015, I used all the data available to estimate the Q matrix (equalvarcov) and R matrix (diagonal and equal). So if one population had data back to 1949, say, and another data til 2015, say, then the data matrix was 1949:2015. Missing values were filled with NAs. So many NAs if one population happened to have a long dataset. The 2015 data_setup() function had min.year=1975, max.year=2014, which makes it seem that it was fitting to min 1975, but that's not what it did. For 2020, I added fit.min.year and fit.max.year to data_setup(), and that forces a min year and a max year that you pass in. Note that if you don't have data up to fit.max.year, it will fill in a bunch of NAs up to fit.max.year.

Ozette Lake sockeye. For 2015, I hard-coded in the Q estimate. It is in trend_fits(). In 2020, I removed this.

The following is the script that was run to produce the figure and tables in the 2020 Status Review:

# June 27, 2021
library(NWCTrends)
fils <- dir("Data/SR2020")
fils <- fils[stringr::str_detect(fils, "csv")]
for(fil in fils){
  infil <- file.path("Data/SR2020", fil)
  outdir <- paste0("Output/", stringr::str_split(fil, "[.]csv")[[1]][1])
  cat("\n", infil, "\n")
  ans <- readline("Run this file? (y/n)")
  if (substr(ans, 1, 1) == "n") next
  NWCTrends::NWCTrends_report(inputfile=infil,
                              fit.min.year=1949, fit.max.year = 2019,
                              plot.min.year=1980, plot.max.year = 2019,
                              geomean.table.control=list(
                                min.year=1990, max.year=2019, lenbands=5, 
                                min.band.points=2, change.col="last.two"),
                              trend.table.control=list(
                                year.ranges=list(1990:2005,2004:2019)),
                              output.type = "word",
                              output.dir = outdir
  )
}

Version 1.0 2015 Status Review

05 Jul 03:07
Compare
Choose a tag to compare

This is the first version of NWCTrends and is largely the code used for the 2015 Status Review. Note the package was written after the analyses for the status review were completed. Thus there are some updates (new tables) that were not in the 2015 Status Review.