-
Notifications
You must be signed in to change notification settings - Fork 7
/
getGraph.R
93 lines (76 loc) · 2.2 KB
/
getGraph.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
#' Get a Graph of Stock Assessment Output
#'
#' Get a graph of stock assessment output, e.g., historical stock size,
#' recruitment, and fishing pressure.
#'
#' @param assessmentKey the unique identifier of the stock assessment
#' @param ... to allow scope for back compatibility
#'
#' @return An array representing a bitmap.
#'
#' @seealso
#' \code{\link{getListStocks}} gets a list of stocks.
#'
#' \code{\link{getFishStockReferencePoints}} gets biological reference points.
#'
#' \code{\link{icesSAG-package}} gives an overview of the package.
#'
#' @examples
#' \dontrun{
#' assessmentKeys <- findAssessmentKey("had", 2015)
#' landings_img <- getLandingsGraph(assessmentKeys[1])
#' plot(landings_img)
#'
#' landings_plots <- getLandingsGraph(assessmentKeys)
#' plot(landings_plots)
#'}
#'
#' @rdname getGraphs
#' @name getStandardAssessmentGraphs
NULL
#' @rdname getGraphs
#' @export
getLandingsGraph <- function(assessmentKey, ...) {
assessmentKey <- checkKeyArg(assessmentKey = assessmentKey, ...)
# get function name as a character
# NOTE need tail(x, 1) here for when calling as icesSAG::get____(assessmentKey)
operation <- utils::tail(as.character(match.call()[[1]]), 1)
# call webservice for all supplied keys
out <- lapply(assessmentKey, function(i) sag_webservice(operation, assessmentKey = i))
# parse output
out <- lapply(out, sag_parse, type = "graph")
# set class
class(out) <- c("ices_standardgraph_list", class(out))
# return
out
}
#' @rdname getGraphs
#' @export
getRecruitmentGraph <- getLandingsGraph
#' @rdname getGraphs
#' @export
getFishingMortalityGraph <- getLandingsGraph
#' @rdname getGraphs
#' @export
getSpawningStockBiomassGraph <- getLandingsGraph
#' @rdname getGraphs
#' @export
getFishMortality <- getLandingsGraph
#' @rdname getGraphs
#' @export
getstock_recruitment <- getLandingsGraph
#' @rdname getGraphs
#' @export
getYSSB <- getLandingsGraph
#' @rdname getGraphs
#' @export
getSSBHistoricalPerformance <- getLandingsGraph
#' @rdname getGraphs
#' @export
getFishingMortalityHistoricalPerformance <- getLandingsGraph
#' @rdname getGraphs
#' @export
getRecruitmentHistoricalPerformance <- getLandingsGraph
#' @rdname getGraphs
#' @export
getStockStatusTable <- getLandingsGraph