Description Usage Arguments Value Examples
Change the availability of predator XXX on specific preygroups.
1 2 |
dietmatrix |
Dataframe in 'long' format containing information about availabilities
with columns 'pred', 'prey', 'pred_stanza', 'prey_stanza', 'code', 'prey_id' and
'avail'. The dataframe should be generated with |
pred |
Character vector of predator Acronyms (see |
pred_stanza |
Integer vector indicating if the predator is juvenile (= 1) or
adult (= 2). |
prey |
List of character vectors of prey Acronyms (see |
roc |
Vector of multiplication factors which shall be applied to the old set of parameters. Please supply one value per selected group. In case relative is FALSE the new absolute values can be passed as roc. |
relative |
Logical if TRUE values are changed relative to base values. If FALSE new values can
be passed directly. Default is |
consecutive |
Boolean indicating if multiple calls to change_avail are performed one after
another |
parameterfile *.prm file with the new parameter values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | d <- system.file("extdata", "setas-model-new-trunk", package = "atlantistools")
dm <- load_dietmatrix(prm_biol = file.path(d, "VMPA_setas_biol_fishing_Trunk.prm"),
fgs = file.path(d, "SETasGroupsDem_NoCep.csv"))
dm1 <- change_avail(dietmatrix = dm,
pred = "FPS",
pred_stanza = 1,
prey = "CEP",
roc = 0.1234,
relative = FALSE)
# Show only rows with availability of 0.1234
dm1[apply(apply(dm1[, 5:ncol(dm1)], MARGIN = 2, function(x) x == 0.1234), MARGIN = 1, any), ]
dm2 <- change_avail(dietmatrix = dm,
pred = c("FPS", "FVS"),
pred_stanza = c(1, 2),
prey = list(c("FPS", "FVS"), c("FPS", "FVS")),
roc = list(c(0.1111, 0.2222), c(0.3333, 0.4444)),
relative = FALSE)
# Show only rows with availability of 0.1111, 0.2222, 0.3333 or 0.4444
dm2[apply(apply(dm2[, 5:ncol(dm2)], MARGIN = 2,
function(x) is.element(x, c(0.1111, 0.2222, 0.3333, 0.4444))), MARGIN = 1, any), ]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.