get_logrank_res: Run Log-Rank Test

Description Usage Arguments Value Examples

View source: R/get_logrank_res.R

Description

get_logrank_res is a wrapper over the survival::survdiff() function return the direct results or the log rank p-value only if specified.

Usage

1
get_logrank_res(in.formula, in.df, return.p = FALSE)

Arguments

in.formula

Survival model formula. Can extract from an existing survfit object with formula(survfit).

in.df

data.frame Corresponding data for the survival model.

return.p

If set to TRUE, return only the log rank p-value.

Value

Results of survdiff or a log rank p-value if return.p is set to TRUE.

Examples

1
2
3
4
5
6
7
8
library("survival")
 
# Get survdiff results
fit <- survfit(Surv(time, status) ~ rx, data = colon)
get_logrank_res(formula(fit), colon)

# Get only log-rank p-value
get_logrank_res(formula(fit), colon, return.p = TRUE)

survutils documentation built on July 23, 2018, 1:02 a.m.