##input model list Models<-params$Models; doc_type<-params$doc_type; verbose = params$InputData$verbose; ##set appendix letter app="A"; ##set knitr options for subsequent chunks knitr::opts_chunk$set(echo=FALSE, error=FALSE, message=FALSE, warning=FALSE, concordance=TRUE, fig.width=6.5, fig.height=7.0, dpi=300) ##set caption numbering if (!exists("fig")){ fig<-1;#figures tbl<-0;#tables } cases<-names(Models); nCases<-length(cases); thm1 = theme(panel.background=element_rect(colour="black",fill="white"), panel.border=element_rect(colour="black",fill=NA), panel.spacing=unit(0.1,"cm") )
if (params$InputData$includeSurveyData){ cat("\n## Survey data\n\n") }
if (params$InputData$includeSurveyData¶ms$InputData$surveys$plotBiomass){ message("starting plotData.SurveyBiomass") cat("\n### Survey biomass\n\n") fleets = params$InputData$surveys$fleets; numRecent = params$InputData$surveys$numRecent; ci = params$InputData$surveys$ci; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type='survey',fleets=fleets, catch.type='index',data.type="biomass",ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp,fleet.type='survey', catch.type='index',data.type="biomass", fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed biomass time series for the ",flt," survey. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed biomass time series for the ",flt," survey (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of survey biomass data were not included.\n\n")}
\FloatBarrier
\clearpage
if (params$InputData$includeSurveyData¶ms$InputData$surveys$plotAbundance){ message("starting plotData.SurveyAbundance") cat("\n### Survey abundance\n\n") fleets = params$InputData$surveys$fleets; numRecent = params$InputData$surveys$numRecent; ci = params$InputData$surveys$ci; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type='survey',fleets=fleets, catch.type='index',data.type="abundance",ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp,fleet.type='survey', catch.type='index',data.type="abundance", fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed abundance time series for the ",flt," survey. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed abundance time series for the ",flt," survey (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of survey abundance data were not included.\n\n")}
\FloatBarrier
\clearpage
if (params$InputData$includeFisheryData){ cat("\n## Fishery data\n\n") }
if (params$InputData$includeFisheryData¶ms$InputData$fisheries$retained$plotBiomass){ message("starting plotData.RetainedCatchBiomass") cat("\n### Retained catch biomass\n\n") fleets = params$InputData$fisheries$fleets; numRecent = params$InputData$fisheries$retained$numRecent; ci = params$InputData$fisheries$retained$ci; fleet.type = "fishery"; catch.type = "retained"; data.type = "biomass"; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type=fleet.type,fleets=fleets, catch.type=catch.type,data.type=data.type,ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp, fleet.type=fleet.type, catch.type=catch.type, data.type=data.type, fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed retained catch biomass time series for the ",flt," fishery. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed retained catch biomass time series for the ",flt," fishery (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of retained catch biomass data were not included.\n\n")}
\FloatBarrier
\clearpage
if (params$InputData$includeFisheryData¶ms$InputData$fisheries$retained$plotAbundance){ message("starting plotData.RetainedCatchAbundance") cat("\n### Retained catch abundance\n\n") fleets = params$InputData$fisheries$fleets; numRecent = params$InputData$fisheries$retained$numRecent; ci = params$InputData$surveys$fisheries$retained$ci; fleet.type = "fishery"; catch.type = "retained"; data.type = "abundance"; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type=fleet.type,fleets=fleets, catch.type=catch.type,data.type=data.type,ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp, fleet.type=fleet.type, catch.type=catch.type, data.type=data.type, fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed retained catch abundance time series for the ",flt," fishery. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed retained catch abundance time series for the ",flt," fishery (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of retained catch abundance data were not included.\n\n")}
\FloatBarrier
\clearpage
if (params$InputData$includeFisheryData¶ms$InputData$fisheries$total$plotBiomass){ message("starting plotData.TotalCatchBiomass") cat("\n### Total catch biomass\n\n") fleets = params$InputData$fisheries$fleets; numRecent = params$InputData$fisheries$total$numRecent; ci = params$InputData$fisheries$total$ci; fleet.type = "fishery"; catch.type = "total"; data.type = "biomass"; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type=fleet.type,fleets=fleets, catch.type=catch.type,data.type=data.type,ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp, fleet.type=fleet.type, catch.type=catch.type, data.type=data.type, fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed total catch biomass time series for the ",flt," fishery. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed total catch biomass time series for the ",flt," fishery (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of total catch biomass data were not included.\n\n")}
\FloatBarrier
\clearpage
if (params$InputData$includeFisheryData¶ms$InputData$fisheries$total$plotAbundance){ message("starting plotData.TotalCatchAbundance") cat("\n### Total catch abundance\n\n") fleets = params$InputData$fisheries$fleets; numRecent = params$InputData$fisheries$total$numRecent; ci = params$InputData$surveys$fisheries$total$ci; fleet.type = "fishery"; catch.type = "total"; data.type = "abundance"; ##--want to make comparisons between datasets used in different models, so ##--plot by fleet, sex, maturity_state, shell_condition (if any data exists) dfr = rCompTCMs::extractMDFR.Data.FleetTimeSeriesABs(Models,fleet.type=fleet.type,fleets=fleets, catch.type=catch.type,data.type=data.type,ci=ci); flts = dfr$fleet %>% unique(); plots = list(); for (flt in flts){ #--testing: flt = flts[2]; dfrp = dfr %>% dplyr::filter(fleet==flt);#--filter for fleet #--determine aggregated x,m,s factor levels and drop from plots as necessary dfrpp = dfrp %>% dplyr::group_by(x,m,s) %>% dplyr::summarize(tot=wtsUtilities::Sum(val)) %>% dplyr::ungroup() %>% dplyr::filter(tot>0) %>% rCompTCMs::dropAggregatedDataLevels(); #--extract only x,m,s in dfrpp dfrppp = dfrp %>% dplyr::inner_join(dfrpp,by=c("x","m","s")) %>% dplyr::mutate(x=as.character(x), m=as.character(m), s=as.character(s)); plts<-rCompTCMs::compareData.FleetTimeSeriesABs(dfrppp, fleet.type=fleet.type, catch.type=catch.type, data.type=data.type, fleets="all", sexs="all", maturity_states="all", shell_conditions="all", facets=x+m+s~fleet, ci=0.8, ylims=c(0,NA), numRecent=numRecent, verbose=FALSE); cap1 = paste0(" \n \nFigure &&fno. Comparison of observed total catch abundance time series for the ",flt," fishery. \n \n"); cap2 = paste0(" \n \nFigure &&fno. Comparison of observed total catch abundance time series for the ",flt," fishery (recent period). \n \n"); plots[[cap1]] = plts[[1]] + thm1; if (numRecent>0) plots[[cap2]] = plts[[2]] + thm1; rm(plts,cap1,cap2,dfrp,dfrpp,dfrppp); }#--flt captions<-wtsUtilities::getCaptionsFromGGPlotList(plots); for (plt in plots) {print(plt); cat("\n\n"); fig<-fig+1;} rm(plt,fleets,numRecent,ci,dfr,flts,flt); } #else {cat("\nPlots of total catch abundance data were not included.\n\n")}
\FloatBarrier
\clearpage
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.