Created
February 29, 2016 01:43
-
-
Save maromato/6033ef5e673b482bdf81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://www1.doshisha.ac.jp/~mjin/R/36/36.htmlが参考になる。 | |
#ID, OS, Status, DrugからなるTableを作る! | |
#ID= Patient Number,OS =length of time, Status =Death or Not, Drug=Control or test | |
library(survival) | |
#ファイルの読み込み | |
t <- read.table(file="FILE NAME.txt",header=T,sep="t",row.names=1) | |
#分析 | |
attach(t) | |
t.surv <- survfit( Surv(OS, Status)~ Drug conf.type="none") | |
summary(t.surv) | |
#KMプロット作成 | |
plot (t.surv,lty=1:2, xlab="Time", ylab="Survival Probability" ) | |
legend(locator(1),c("Drug -","Drug +"),lty=c(1,2)) | |
#Statistical analysis | |
survdiff(Surv(OS)~Drug,data=t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment