Learn R Programming

eq5dsuite (version 1.0.2)

toEQ5Dindex: Convert EQ-5D dimension scores to a five-digit profile index

Description

Convert EQ-5D dimension scores to a five-digit profile index

Usage

toEQ5Dindex(
  x,
  dim.names = c("mo", "sc", "ua", "pd", "ad"),
  na.rm = FALSE,
  quiet = FALSE
)

Value

An integer vector with one element per row (data.frame/matrix input) or a single integer (vector input). Works inside dplyr::mutate()

without rowwise().

Arguments

x

A data.frame, matrix, or named numeric vector of EQ-5D dimension scores. Each dimension must contain integer values (typically 1–3 or 1–5).

dim.names

Character vector of length 5 giving the dimension names, in the conventional MO, SC, UA, PD, AD order.

na.rm

Logical. If FALSE (default), any NA in a row produces NA in the output. If TRUE, NA dimensions are treated as 0 — use with care, as this silently changes the index value.

quiet

Logical. Suppress informational messages about assumed column / name order. Default FALSE so existing scripts see the same messages; set TRUE inside pipelines.

Examples

Run this code
# Named vector — scalar usage unchanged
toEQ5Dindex(c(mo=1, sc=2, ua=3, pd=1, ad=2))

Run the code above in your browser using DataLab