Methods for Creating, Accessing and Assigning Kobe objects
Source: R/aa_generics.R, R/class_Kobe.R, R/class_Slick.R
Kobe-methods.RdThe Kobe function is used both to create and modify an Kobe-class() object.
and to access and assign Kobe for an object of class Slick-class().
See Details.
Usage
Kobe(
Code = "",
Label = "",
Description = "",
Time = numeric(),
TimeLab = "Year",
Value = array(),
Preset = list(),
Target = 1,
Limit = NULL,
Defaults = list(),
TimeTerminal = numeric(),
Misc = list()
)
Kobe(Slick) <- value
# S4 method for class 'missing'
Kobe()
# S4 method for class 'character'
Kobe(
Code = "",
Label = "",
Description = "",
Time = numeric(),
TimeLab = "Year",
Value = array(),
Preset = list(),
Target = 1,
Limit = NULL,
Defaults = list(),
TimeTerminal = numeric(),
Misc = list()
)
# S4 method for class 'list'
Kobe(
Code = "",
Label = "",
Description = "",
Time = numeric(),
TimeLab = "Year",
Value = array(),
Preset = list(),
Target = 1,
Limit = NULL,
Defaults = list(),
TimeTerminal = numeric(),
Misc = list()
)
# S4 method for class 'Slick'
Kobe(Code)
# S4 method for class 'Slick'
Kobe(Slick) <- valueArguments
- Code
A short code for the Performance Indicators for this object. A character string length
nPIor a named list for multi-language support. SeeDetails- Label
A short label for the Performance Indicators for this object. Used to label axes on charts. Can be longer than
Codebut recommended to keep short as possible so it shows clearly in plots and tables. A character string lengthnPIor a named list for multi-language support. SeeDetails- Description
A description for the Performance Indicators for this object. Can include Markdown, see
Examples. A character string lengthnPIor a named list for multi-language support. SeeDetails- Time
A numeric vector with values for the projection time-steps. Must match length
nTSinValue- TimeLab
Character string length 1. Name of the time step (e.g., 'Year'). Will be used as the label in the
Kobe Timeplot. Use a named list for multiple languages.- Value
A numeric array with the stochastic performance indicator values for each simulation (sim), operating model (OM), management procedure (MP), performance indicator (PI), and projection time-steps (nTS). Dimensions: c(
nsim,nOM,nMP,nPI,nTS)- Preset
An optional named list for the preset buttons in the
App(). The name of the list element will appear as a button in theApp().- Target
Numeric vector length
nPIwith the target value for the PIs. Defines the color quadrants on the Kobe plot. Defaults to c(1,1).- Limit
Numeric vector length
nPIwith the limit value for the PIs. Shows as red line on Kobe plot. NULL to ignore.- Defaults
A list object with default selections for the Kobe See
Kobe()- TimeTerminal
Optional. By default the
Kobeplot shows the terminal projection year.TimeTerminalcan be used to override this. Use a numeric value indicating the time (must match a value inTime) to use for theKobeplot- Misc
A named list for additional miscellaneous information.
- Slick
A
Slick-class()object- value
A
Kobe-class()object
Details
Objects of class Kobe are created with Kobe()
The Kobe plot typically shows B/BMSY (or something similar) on the x-axis, and F/FMSY (or something similar) on the y-axis.
Performance Indicators
The first PI will be on the x-axis (usually B/BMSY or something similar) and the second on the y-axis (e.g., F/FMSY)
Functions
Kobe(missing): Create an emptyKobeobjectKobe(character): Create a populatedKobeobjectKobe(list): Create a populatedKobeobjectKobe(Slick): ReturnKobefrom aSlick-class()objectKobe(Slick) <- value: Assign aKobe-class()object to aSlick-class()object
Examples
# Generate dummy values
nsim <- 10
nOM <- 2
nMP <- 4
nPI <- 2
nTS <- 30
values <- array(NA, dim=c(nsim, nOM, nMP, nPI, nTS))
pi_means <- c(1,1)
for (om in 1:nOM) {
for (mp in 1:nMP) {
for (pi in 1:nPI) {
values[,om, mp, pi,] <- pi_means[pi] *
matrix(
cumprod(c(rlnorm(nTS*nsim, 0, 0.05))),
nrow=nsim)
}
}
}
# Create and populate Object
kobe <- Kobe(Code=c('B/BMSY', 'F/FMSY'),
Label=c('B/BMSY',
'F/FMSY'),
Description = c('This is the description for PI 1',
'This is the description for PI 2'),
Value=values
)
# Add values for projection time steps
Time(kobe) <- seq(2025, by=1, length.out=nTS)
# Check
Check(kobe)
#>
#> ── Checking: "Kobe" ──
#>
#> ✔ Complete
# Add to `Slick` object
slick <- Slick()
Kobe(slick) <- kobe
# Plots
plotKobe(slick)
#> Error in plotKobe(slick): object 'nMP' not found
plotKobe(slick, Time=TRUE)
#> Error in plotKobe(slick, Time = TRUE): object 'nMP' not found