
Extract hazard parameter modalities and labels from a damage sheet
get_damage_parameter.Rdget_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, columnsd_min/d_max),"p"(period, columnsp_min/p_max),"v"(velocity, columnsv_min/v_max), or"s"(salinity, columnsalinite).- value
numeric or character, subset of parameter modalities to keep. If
NULL(default), all available values inxare kept.
Value
A named list with four elements:
ref: data.frame of unique modalities sorted by increasing value (orNULLif the parameter is not present inx),avail: character vector of all available values (orNA),value: character vector of selected values (orNA),label: named character vector of formatted labels for the selected values (orNA).
See also
Other damage function:
plot_damage_function(),
read_damage_function(),
save_damage_function(),
select_damage()