dot-add_utility: Add utility values to a data frame

.add_utilityR Documentation

Add utility values to a data frame

Description

This function adds utility values to a data frame based on a specified version of EQ-5D and a country name.

Usage

.add_utility(df, eq5d_version, country)

Arguments

df

A data frame containing the state data. The state must be included in the data frame as a character vector under the column named 'state'.

eq5d_version

A character string specifying the version of EQ-5D, i.e. 3L or 5L.

country

A character string representing the name of the country. This could be in a 2-letter format, full name or short name, as specified in the country_codes datasets.

Value

A data frame with an additional column named 'utility' containing the calculated utility values. If the input country name is not found in the country_codes dataset, a list of available codes is printed, and subsequentyl an error message is displayed and the function stops.

Examples

df <- data.frame(state = c("11111", "11123", "32541"))
.add_utility(df, "5L", "DK")

eq5dsuite documentation built on April 11, 2026, 5:06 p.m.