km.table: Extract Data from KM Curve When Number at Risk Table Is...

Description Usage Arguments Value References Examples

View source: R/KM.functions.R

Description

This function derives or extracts IPD when only number at risk table information are available

Usage

1
km.table(t.risk.T, n.risk.T, group.name = "group", data)

Arguments

t.risk.T

vector of time points from the number at risk table

n.risk.T

vector of patients' number at risk at time points from the table

group.name

name of treatment group

data

data frame with 2 columns; 1st column has digitised time information and 2nd column has digitised survival rate information

Value

data frame with time to event, censoring, and group name information

References

\insertRef

guyot2012enhancedextractKM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
df <- ex.table[,1:2]
df <- df[!is.na(df$x1) & !is.na(df$y1),]  # only valid data
res1 <- km.table(t.risk.T = c(0,25,50,75,100,125),
                 n.risk.T = c(22,18,10,7,5,2),
                 group.name="group1",
                 data=df);res1

df <- ex.event[,3:4]
df <- df[!is.na(df$x2) & !is.na(df$y2),]
res2 <- km.table(t.risk.T = c(0,25,50,75),
                 n.risk.T = c(5,1,1,0),
                 group.name="group2",
                 data=df);res2

library(survival)
result <- rbind(res1,res2); 
km <- survfit(Surv(Surv.Time, Censor) ~ Group, data=result);km
plot(km)

vandy10s/extractKM documentation built on July 24, 2020, 12:55 p.m.