Skip to contents

Prints a formatted overview of a clinical metadata data frame, identifying which columns are suitable for facet_row / facet_col in SurvPlot, which columns look like survival time or event indicators, and flagging columns with high missingness.

Usage

SurvMetaSummary(meta, max_levels = 10L, na_threshold = 0.5, show_all = FALSE)

Arguments

meta

Data frame of sample-level clinical metadata.

max_levels

Integer (default 10). Columns with more unique non-NA values than this are treated as continuous and shown separately.

na_threshold

Numeric (default 0.5). Columns where more than this fraction of values are NA are flagged as high-missingness.

show_all

Logical (default FALSE). If TRUE, prints every column including those with > max_levels unique values. Useful for large data frames where you want to see numeric columns too.

Value

Invisibly returns a data frame with one row per column containing: column, type, n_unique, pct_na, category (one of "survival_time", "survival_event", "good_facet", "many_levels", "high_na", "numeric"), and sample_values.

Details

Designed to be called on the $meta element returned by LoadTCGA before running SurvPlot.

See also

Examples

if (FALSE) { # \dontrun{
gbm <- LoadTCGA("TCGA-GBM")
SurvMetaSummary(gbm$meta)

# See all columns including numeric ones
SurvMetaSummary(gbm$meta, show_all = TRUE)
} # }