### Example using demo data with five pressures, four components and their individual
# uncertainties (probabilities are assumed to be 1):
ex_expert_exposure
calc_exposure(
pressures = ex_expert_exposure$pressure,
components = ex_expert_exposure[ ,2:5],
uncertainty = ex_expert_exposure[ ,6:9]
)
### Example for two hazardous risks with only two components ('magnitude' and
# 'spatial'), one general uncertainty score, and associated probabilities:
hazard <- c("heat waves", "hurricanes")
# Create scoring table using the template function:
exp_tbl <- create_template_exposure(
pressures = hazard,
n_components = 2,
mode_uncertainty = "general",
probability = TRUE
)
names(exp_tbl)[2:3] <- c("magnitude", "spatial")
# Assign component-specific scores and probabilities:
exp_tbl$magnitude <- c(5,4)
exp_tbl$spatial <- c(5,3)
exp_tbl$uncertainty <- c(2,3)
exp_tbl$probability <- c(0.8,0.3)
# Calculate exposure score:
calc_exposure(
pressures = exp_tbl$pressure,
components = exp_tbl[ ,c("magnitude", "spatial")],
probabilities = exp_tbl$probability,
uncertainty = exp_tbl$uncertainty
)
Run the code above in your browser using DataLab