Skip to contents

get_damage_parameter() inspects a damage function sheet for a given hazard parameter ("d", "p", "v", or "s"), sorts the available modalities, filters them according to value, and builds formatted labels for plot titles and legends.

Usage

get_damage_parameter(x, parameter = c("d", "p", "v", "s"), value = NULL)

Arguments

x

data.frame corresponding to a sheet of a "damage_function" object.

parameter

character, code of the hazard parameter: "d" (duration, columns d_min/d_max), "p" (period, columns p_min/p_max), "v" (velocity, columns v_min/v_max), or "s" (salinity, column salinite).

value

numeric or character, subset of parameter modalities to keep. If NULL (default), all available values in x are kept.

Value

A named list with four elements:

  • ref: data.frame of unique modalities sorted by increasing value (or NULL if the parameter is not present in x),

  • avail: character vector of all available values (or NA),

  • value: character vector of selected values (or NA),

  • label: named character vector of formatted labels for the selected values (or NA).