-
Notifications
You must be signed in to change notification settings - Fork 0
/
SSFishGraph.R
127 lines (100 loc) · 3.21 KB
/
SSFishGraph.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#' A function for converting Stock Synthesis output to the format used by
#' FishGraph
#'
#' Only skeleton of a function right now, needs work. Intended as a translator
#' to convert the output from object created by \code{\link{SS_output}} to the
#' format used by FishGraph.
#'
#'
#' @param replist Object created by SS_output
#' @param title Title of output
#' @param species Species name
#' @author Ian Taylor
#' @references A website related to FishGraph is
#' \url{http://r-forge.r-project.org/projects/fishgraph/}
SSFishGraph <-
function(replist,
title="SSv3 output",
species="some kind of fish")
{
x <- list() # this will be the big output list
### create list: info
x$info <- list()
x$info$date <- replist$repfiletime
x$info$title <- title
x$info$species <- species
x$info$model <- paste("Stock Synthesis version", strsplit(replist$SS_version,";")[[1]][1])
x$info$base.run <- "don't know"
# for all these units, it's probably best to read them from a file
# (these values are just what was present in the gag example file)
x$info$units.length <- "mm"
x$info$units.weight <- "gutted lbs"
x$info$units.landings.wgt <- "1000 gutted lbs"
x$info$units.numbers <- "1000s"
x$info$units.naa <- "10^6 fish"
x$info$units.biomass <- "mt"
x$info$units.ssb <- "10^9 eggs"
x$info$units.rec <- "1000 fish"
x$info$rec.model <- c("Beverton-Holt with flat-top beyond Bzero",
"Ricker",
"standard Beverton-Holt",
"ignore steepness")[replist$SRRtype]
x$info$units.length2 <- "inches"
x$info$units.length3 <- "cm"
x$info$units.weight2 <- "gutted kg"
x$info$units.landings <- "1000 gutted lbs"
x$info$units.discards <- "1000 gutted lbs"
### create list: parms
# note: this will probably require renaming parameters
parmtable <- replist$parameters
x$parms <- as.list(parmtable$Value)
names(x$parms) <- parmtable$Label
### create list: like
x$like <- list()
### create list: sel.parms
x$sel.parms <- list()
### create list: N.age
x$N.age <- list()
### create list: B.age
x$B.age <- list()
### create list: Z.age
x$Z.age <- list()
### create list: L.age.pred.num
x$L.age.pred.num <- list()
### create list: L.age.pred.wgt
x$L.age.pred.wgt <- list()
### create list: C.age.pred.num.c.hal
x$C.age.pred.num.c.hal <- list()
### create list: C.age.pred.num.c.dv
x$C.age.pred.num.c.dv <- list()
### create list: C.age.pred.num.hb
x$C.age.pred.num.hb <- list()
### create list: C.age.pred.num.mrfss
x$C.age.pred.num.mrfss <- list()
### create list: prop.m.obs
x$prop.m.obs <- list()
### create list: sel.age
x$sel.age <- list()
### create list: comp.mats
x$comp.mats <- list()
### create list: t.series
x$t.series <- list()
### create list: a.series
x$a.series <- list()
### create list: eq.series
x$eq.series <- list()
### create list: pr.series
x$pr.series <- list()
### create list: CLD.est.mats
x$CLD.est.mats <- list()
### create list: sel.length
x$sel.length <- list()
### create list: F.age
x$F.age <- list()
### create list: M.age
x$M.age <- list()
### create list: M2.age
x$M2.age <- list()
### return the big list
return(x)
}