2017-04-06 83 views
0

使用survminer包(ggsurvplot)我使用的survminer包以創建的Kaplan-Meier-曲線中的R,這是相當不錯的截尾活動的形狀:改變中的R

plotUICC=survfit(Surv(as.numeric(myData$eventtime),event=myData$eventtype)~myData$UICC, data = myData) 

ggsurvplot(plotUICC,data=myData, risk.table = FALSE,pval = TRUE,conf.int = FALSE,legend.labs = c("UICC I", "UICC II"),legend = c(0.25, 0.26),legend.title = "",xlab = "Time in Months")) 

Kaplan Meier Curve created with the Cod above

我想將「+」更改爲審查事件,並使用簡單的「|」代替。不幸的是,無論是幫助(ggsurvplot)還是谷歌都無法幫助我。


這些是加載packeges:

other attached packages: 
[1] ggthemes_3.4.0 survminer_0.3.1 ggpubr_0.1.2 ggplot2_2.2.1 survival_2.40-1 
[6] readxl_0.1.1 gridExtra_2.2.1 
+0

可以展開通過提供一個最小工作示例您的問題(http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – CMichael

回答

1

的最小工作示例如下:

library(survminer) 
library(survival) 
fit <- survfit(Surv(time, status) ~ sex, data = lung) 
p1 <- ggsurvplot(fit, data = lung) 

理想情況下,一個想例如改變檢查員的形狀像這樣:

p2 <- ggsurvplot(fit, data = lung, censor.shape=124) 

我發現沒有辦法做到這一點與原始的倖存者包。在survminer的fork,我已經實現了這個行爲,讓下面的情節產生:

enter image description here

爲censor.shape可接受值可以在這裏找到: http://sape.inf.usi.ch/quick-reference/ggplot2/shape

我沒有徹底地測試了這個,但是這個擴展對我來說已經非常有用了。該「+」檢查員已經困擾了我一段時間......

編輯:現在這個建議被合併,ggsurvplot的development version現在接受censor.shape和censor.size參數:

ggsurvplot(fit, data = lung, censor.shape="|", censor.size = 4)