簡體   English   中英

使用R中的survminer軟件包(ggsurvplot)更改審查事件的形狀

[英]Changing the shape of Censored Events using the survminer package (ggsurvplot) in R

我正在使用survminer軟件包在R中創建Kaplan-Meier-Curve,效果很好:

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曲線

我想將“ +”更改為受檢查事件,並使用簡單的“ |” 代替。 不幸的是,help(ggsurvplot)和Google都無法幫助我。


這些是已加載的軟件包:

    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

下面是一個最小的工作示例:

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軟件包來做到這一點。 在survminer的分支中,我實現了此行為,因此產生了以下圖:

在此處輸入圖片說明

可以在此處找到censor.shape的可接受值: http ://sape.inf.usi.ch/quick-reference/ggplot2/shape

我尚未對此進行全面測試,但是此擴展名對我已經非常有用。 “ +”審查員困擾了我一段時間。

編輯:此建議現已合並,ggsurvplot的開發版本現在接受censor.shape和censor.size參數:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM