as_survmat: Construct a survival matrix object

View source: R/core-survmat.R

as_survmatR Documentation

Construct a survival matrix object

Description

Construct a survival matrix object

Usage

as_survmat(S, time, id = NULL, group = NULL)

Arguments

S

Numeric matrix of survival probabilities (rows = subjects, columns = time).

time

Numeric strictly increasing time grid with length(time) == ncol(S).

id

Optional subject identifiers. Defaults to seq_len(nrow(S)).

group

Optional group labels with length nrow(S).

Value

An object of class "survmat".

Examples

time <- c(0, 1, 2)
S <- rbind(
  c(1.0, 0.8, 0.6),
  c(1.0, 0.7, 0.5)
)
x <- as_survmat(S, time, group = c("A", "B"))
x

tvrmst documentation built on March 17, 2026, 1:07 a.m.