Learn R Programming

eq5dsuite (version 1.0.1)

figure_1_2_3: Figure 1.2.3: Percentage of Respondents Who Worsened in Each EQ-5D Dimension, by Group

Description

This function identifies respondents with a "Worsen" PCHC state (i.e., overall health state got worse between levels_fu[1] and levels_fu[2]), checks dimension-specific changes (e.g., mo_diff < 0), and summarizes by a grouping variable (e.g., procedure) and time points. It returns a data table and a ggplot object.

Usage

figure_1_2_3(
  df,
  name_id,
  name_groupvar,
  names_eq5d = NULL,
  name_fu = NULL,
  levels_fu = NULL
)

Value

A list containing:

plot_data

A data frame of "Worsen" percentages by group and dimension

p

A ggplot2 object produced by `.pchc_plot_by_dim()`

Arguments

df

A data frame containing EQ-5D columns, a grouping variable, an ID column, and a follow-up column

name_id

A character string for the patient ID column

name_groupvar

A character string for the grouping column (e.g., procedure)

names_eq5d

A character vector of EQ-5D dimension names

name_fu

A character string for the follow-up column

levels_fu

A character vector of length 2, specifying the order of the follow-up levels (e.g., c("Pre-op","Post-op"))

Examples

Run this code
result <- figure_1_2_3(
  df = example_data,
  name_id = "id",
  name_groupvar = "procedure",
  names_eq5d = c("mo", "sc", "ua", "pd", "ad"),
  name_fu = "time",
  levels_fu = c("Pre-op","Post-op")
)
result$p        # shows the plot
result$plot_data  # shows the summary table

Run the code above in your browser using DataLab