### Demo with output data from the risk() and aggregate_risk() functions
# based on expert scores.
# Using default settings for the overall risk scores and associated uncertainty
# scores (i.e. in this case, combined across both types)
p_heat <- plot_heatmap(
risk_scores = ex_output_risk_expert,
aggregated_scores = ex_output_aggregate_risk_expert
)
# For each type in both input datasets, a heatmap is generated
p_heat[[1]] # display direct effects
p_heat[[2]] # display direct/indirect effects
# The following examples can run for a longer time, thus they are in dontrun{}.
# Hide uncertainty results and order indicators and pressures manually
if (FALSE) {
p_heat_mod <- plot_heatmap(
risk_scores = ex_output_risk_expert,
aggregated_scores = ex_output_aggregate_risk_expert,
order_ind = c("phytoplankton", "herring", "cod", "seabirds"),
order_press = c("temperature", "salinity", "oxygen", "nutrient",
"fishing"),
uncertainty = FALSE
)
p_heat_mod[[1]]
}
### Demo with combined expert-based and model-based pathways
if (FALSE) {
combined_risk <- rbind(ex_output_risk_expert, ex_output_risk_model)
aggr_risk <- aggregate_risk(risk_results = combined_risk)
# Default settings (combined type and pathway)
p_heat_comb <- plot_heatmap(
risk_scores = combined_risk,
aggregated_scores = aggr_risk
)
p_heat_comb[[1]]
}
### Demo with two indicators assessed with both pathways
if (FALSE) {
risk_model <- ex_output_risk_model[c(1, 3, 5, 7, 8, 9, 12, 14:16), ]
risk_model$pressure <- c(
"nutrient", "temperature", "salinity", "oxygen", "fishing", # for zooplankton
"nutrient", "temperature", "salinity", "oxygen", "fishing") # for cod
dummy_model <- risk_model |>
dplyr::mutate(indicator = dplyr::case_when(
indicator == "zooplankton_mean_size" ~ "phytoplankton",
.default = "cod"
))
}
if (FALSE) {
risk_comb <- rbind(ex_output_risk_expert, dummy_model)
aggr_risk_comb <- aggregate_risk(risk_results = risk_comb)
# show results from both types and pathways individually and order the state
# indicators manually
p_heat_2_paths <- plot_heatmap(risk_scores = risk_comb,
aggregated_scores = aggr_risk_comb,
output_2_pathway_indicators = 2,
order_ind = c("phytoplankton", "herring", "cod", "seabirds"))
p_heat_2_paths
# show one plot per type and average across the pathways
p_heat_mean_path <- plot_heatmap(risk_scores = risk_comb,
aggregated_scores = aggr_risk_comb,
output_2_pathway_indicators = 1,
order_ind = c("phytoplankton", "herring", "cod", "seabirds"))
p_heat_mean_path
}
Run the code above in your browser using DataLab