Learn R Programming

mccount (version 0.1.1)

mcc_final_values: Get final MCC value for each group

Description

Extracts the final (maximum time) MCC value for each group in a grouped analysis, or the overall final MCC value for ungrouped analyses.

Usage

mcc_final_values(x)

Value

A named numeric vector with final MCC values

Arguments

x

An mcc object

Examples

Run this code
# Create sample data
library(dplyr)
df <- data.frame(
  id = c(1, 2, 3, 4, 4, 4, 5, 5),
  time = c(8, 1, 5, 2, 6, 7, 3, 3),
  cause = c(0, 0, 2, 1, 1, 1, 1, 2),
  group = c("A", "A", "B", "B", "B", "B", "A", "A")
) |>
  arrange(id, time)

# Ungrouped analysis
mcc_ungrouped <- mcc(df, "id", "time", "cause")
mcc_final_values(mcc_ungrouped)

# Grouped analysis
mcc_grouped <- mcc(df, "id", "time", "cause", by = "group")
mcc_final_values(mcc_grouped)

# Clean up
rm(df, mcc_ungrouped, mcc_grouped)

Run the code above in your browser using DataLab