JS.uni: A complete table for univariable survival analysis (C index,...

Description Usage Arguments Value Examples

View source: R/JSuni.R

Description

JS.uni output the table with general multivariable survival analysis result with Number of total patients, Number of Events, HR (95% Confidence Interval),P value, C index and D index. This function only change the format of the output table. Note: c index and d index are from package survcomp.

JS.uniLR output the table with total number, number of events, estimented survival(Time can be difinded) and p-value. Note: this function can only be used for catagorical analysis.

Usage

1
2
3
4
JS.uni(Data, Event, Stime, Svar, groupn, Cat = F, cindex = F, dindex = F,
  AIC = F)

JS.uniLR(Data, Event, Stime, Svar, groupn, month, Rho = 0, ci95 = FALSE)

Arguments

Event

The status indicator, normally 0=alive, 1=dead

Stime

This is the follow up time

Svar

A vector of group

groupn

A text vector of the the group name for output

Cat

logical, indicating whether or not Svar is a categorical varaible

cindex

logical, indicating whether or not cindex should be in the table

dindex

logical, indicating whether or not dindex should be in the table

AIC

logical, indicating whether or not AIC should be in the table

month

Time for survival estimation

Rho

a scalar parameter that controls the type of test. With 'rho = 0' this is the log-rank or Mantel-Haenszel test, and with 'rho = 1' it is equivalent to the Peto & Peto modification of the Gehan-Wilcoxon test.

D

A data.frame in which to interpret the variables

D

A data.frame in which to interpret the variables

Event

The status indicator, normally 0=alive, 1=dead

Stime

This is the follow up time

Svar

A vector of group

groupn

A text vector of the the group name for output

Value

A dataframe of coxph output including Number of total patients, Number of Events, HRs (95% Confidence Intervals), P values, C index and D index.

A dataframe of output including Number of total patients, Number of Events, Estimited survival , P values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
JS.uni(D = D ,"pd_censor", "pd_surv" , "tr_group", "Treatment" , Cat = T , cindex = F, dindex = F, AIC = F)

rtf output
rtf<-RTF("Table_survival.doc",width = 8.5, height = 11, font.size = 10, omi = c(1,1,1,1))
addHeader(rtf,title="Table , Survival Analysis  ")
addTable(rtf,isup_m.surv, font.size = 10, row.names = F, NA.string="-", col.widths = c(rep(0.6, 3), 2, rep(0.6, 3) ) )
done(rtf))

Rmarkdown output
save(isup_m.surv, file='myfile.Rda')

Then open at markdown file
library(knitr)
load("H:/Projects/myfile.Rda")
"```{r, echo=FALSE,results = 'asis'}"
output <- load("H:/Projects/p_Smith, Mitchell/Rituxan/Rituxan/T_BMI.Rdata")
knitr::kable(isup_m.surv, format = "markdown")  

Rho 
JS.uniLR(Data, Event, Stime, Svars[i] , groupns[i], month, Rho)

rtf output
rtf<-RTF("Table_survival.doc",width = 8.5, height = 11, font.size = 10, omi = c(1,1,1,1))
addHeader(rtf,title="Table , Survival Analysis  ")
addTable(rtf,isup_m.surv, font.size = 10, row.names = F, NA.string="-", col.widths = c(rep(0.6, 3), 2, rep(0.6, 3) ) )
done(rtf))

Rmarkdown output
save(isup_m.surv, file='myfile.Rda')

Then open at markdown file
library(knitr)
load("H:/Projects/myfile.Rda")
"```{r, echo=FALSE,results = 'asis'}"
output <- load("H:/Projects/p_Smith, Mitchell/Rituxan/Rituxan/T_BMI.Rdata")
knitr::kable(isup_m.surv, format = "markdown")  

SophiaJia/Jsurvformat documentation built on Sept. 23, 2017, 1:59 p.m.