km.tab.event: Extract Data from KM Curve When Both Number at Risk Table and...

Description Usage Arguments Value References Examples

View source: R/KM.functions.R

Description

This function derives or extracts IPD when both number at risk table and total number of events information are available

Usage

1
km.tab.event(t.risk.T, n.risk.T, t.event = "NA", 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

t.event

numeric value; total number of events

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
19
20
df <- ex.tab.event[,1:2]
df <- df[!is.na(df$x1) & !is.na(df$y1),]  # only valid data
res1 <- km.tab.event(t.risk.T = c(0,24,48,72,96,120), 
                     n.risk.T = c(23,11,8,4,2,0), 
                     t.event=5, 
                     group.name="group1",
                     data=df);res1

df <- ex.tab.event[,3:4]
df <- df[!is.na(df$x2) & !is.na(df$y2),]
res2 <- km.tab.event(t.risk.T = c(0,24,48,72,96,120),
                     n.risk.T = c(12,3,3,2,1,1),
                     t.event=8,
                     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.