km.event: Extract Data from KM Curve When Number of Events Information...

Description Usage Arguments Value References Examples

View source: R/KM.functions.R

Description

This function derives or extracts IPD when only total number of events information are available

Usage

1
km.event(ssize, t.event = "NA", group.name = "group", data)

Arguments

ssize

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
df <- ex.event[,1:2]
df <- df[!is.na(df$x1) & !is.na(df$y1),]  # only valid data
res1 <- km.event(ssize=16, t.event=13, group.name="group1", data=df); res1

df <- ex.event[,3:4]
df <- df[!is.na(df$x2) & !is.na(df$y2),]
res2 <- km.event(ssize=39, t.event=28, 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.