knitr::opts_chunk$set(echo=FALSE, error=FALSE, message=FALSE, warning=FALSE,
                      dpi=300,fig.width=6.5,fig.height=3.9)
    require(pander);
    require(ggplot2);
    require(ggthemes);
    require(reshape2);
    require(rTCSAM2013);
    require(wtsUtilities);
    panderOptions("table.caption.prefix","Table ")
    panderOptions("table.split.table",Inf)
    paths<-params$paths;
    obj<-params$obj;
    numRecent<-params$numRecent;
    plot1stObs<-TRUE;
    figno<-1;
    tblno<-1;
    cat("Working dir = '",getwd(),"'\n\n");

Input model cases

    if (is.null(obj)){
        if (!is.character(paths)){
            cat("'paths' parameter is not a character vector!\n");
            stop();
        }
        obj<-list();
        for (case in names(paths)){
            cat(case,": '",paths[case],"'\n",sep='');
            res<-getResLst(inp.dir=paths[case]);
            if (is.null(res)) {
                #remove path from paths
                paths<-paths[names(paths)!=case];
            } else {
                #add res to obj list
                obj[[case]]<-res;
            }
            rm(res);
        }
    } else {
        obj<-convertToListOfResults(obj);
    }
    cases<-names(obj);
    ncases<-length(cases);
    if (!is.null(paths)){ 
        t<-as.data.frame(list(case=cases, path=getSubPaths(paths,last=3)));
        t$path<-paste0("'",t$path,"'");
    } else {
        t<-as.data.frame(list(case=cases));
    }
    row.names(t)<-NULL;
    pander(t,caption=paste0(tblno,". Model cases for comparison."));
    tblno<-tblno+1;

Population quantities

    plots<-compareModelResults.PopQuantities(obj,
                                            numRecent=numRecent);
    plots<-plots[1:4];
    figno<-(printGGList(plots,figno=figno,show=TRUE))$figno;
    rm(plots);

Survey quantities

    plots<-compareModelResults.SurveyQuantities(obj,
                                                numRecent=numRecent,
                                                plot1stObs=plot1stObs);
    plots<-plots[1:2];#survey mature biomass
    figno<-(printGGList(plots,figno=figno,show=TRUE))$figno;
    rm(plots);

Fisheries quantities

    plots<-compareModelResults.FisheryQuantities(obj,
                                                numRecent=numRecent,
                                                plot1stObs=plot1stObs);
    plots<-plots[1:2];#retained catch biomass
    figno<-(printGGList(plots,figno=figno,show=TRUE))$figno;
    rm(plots);


wStockhausen/rTCSAM2013 documentation built on May 3, 2019, 7:13 p.m.