Questions tagged [survminer]

Questions related to survminer package

An R package that draws survival curves using 'ggplot2'. See more details at survminer documentation.

95 questions
0
votes
1 answer

Why does the survival probability of the survival package return 0% at the end of the time horizon when there are survivors in the dataset?

I've just started using the survival and survminer packages in R and am trying to understand its output. In the code below I create a dataframe with the first 12 rows of my actual dataset, as representative of the issue/question. In this…
Village.Idyot
  • 1,359
  • 2
  • 8
0
votes
1 answer

how to change order of rows in ggforest without change reference

Imagine the following database. Made up data K<- c(2,2.2,2.4,2.6,2.8,3,3.5,3.8,4,4.2,4.4,4.8,5,5.2,5.4,5.6,5.8,6) event <- c(1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1) t<- c(8,10,25,10,8,22,30,16,32,30,32,20,8,12,14,22,10,6) df<- data.frame(K,event,t) I…
0
votes
1 answer

How to add labels to multiple plots using ggsurvplot and arrange_ggsurvplots in r

I am trying to create a figure in R that includes multiple kaplan-meier curves, and label each kaplan-meier plot (i.e. "A", "B", "C"). Reading previous recommendations, they recommend using labs(tag="A") for each plot. However, when I try this I get…
mepstein1218
  • 331
  • 5
  • 14
0
votes
1 answer

ggsave ggsurvplot with risk.table

I am trying to save a ggsurvplot with risk.table using ggsave. However, the output off ggsave is always just the risk.table. I also tried this and this. None is working. library(data.table) library(survival) library(survminer) OS <- c(c(1:100),…
gernophil
  • 177
  • 2
  • 6
0
votes
3 answers

Remove dash on strata line when using ggsurvplot and survminer

How do I change the line type for the sex strata so that it is a line without all the small "crosses" as shows in the picture below? I hope to get just a solid line instead. The cross makes things look a little congested when there is a lot of data…
curious
  • 640
  • 4
  • 10
0
votes
1 answer

Stop clipping ggsurvplot risk table text while annotating right-side of survival graph (short labels)

I want to specify the end time in my ggsurvplot, annotating the ends of the survival curves as shown below. But this leads to a truncation of the rightmost text in number-at-risk table. See code and output graphic below. Note that in the graphic,…
0
votes
2 answers

ggsurvplot risk table misaligned after annotating to the right of survival graph

I want to add survival percentages at the end of the curves. Doing so leads to the risk table not lining up with the graph (the graph width is reduced relative to the risk table width). Code to reproduce the…
0
votes
1 answer

Plotting a multipanel survival plot with risk tables using ggarrange

I have made some nice survival plots with risk tables (sequence and histology) using using the survminer library. The data is at https://drive.google.com/file/d/1Svtmyj9w968toggDshLg9eYex9N_fws5/view?usp=share_link The data is at…
Joe Erinjeri
  • 1,200
  • 1
  • 7
  • 15
0
votes
0 answers

Is there a way to use survSplit to cut each observation at a different time?

I'm working on the following dataset: https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset I'm trying to conduct a survival analysis on this dataset, but with so many measurements that depend on time after the start of…
0
votes
1 answer

Produce a facet with an overall group in ggsurvplot in R

In R, I am using ggsurvplot_facet to produce survival curves plotted for groups sex as a facet stratified by a variable ecog. However, I would like to have an overall group as well in the same facet as well. Is this possible? ggsurvplot_add_all did…
ebay
  • 109
  • 1
  • 7
0
votes
1 answer

Match ggsurvplot legend text color to line color, include risk table

Related to this previous post about changing the color of the figure legend text to match graphing colors in ggplot, I would like to extend this to ggsurvplot objects. fit <- survfit(Surv(time, status) ~ sex, data = lung) fitgraph <- ggsurvplot(fit,…
Timmo83
  • 119
  • 5
0
votes
1 answer

Survminer - include subset of variables in plot

Let's say I want to plot the survival curves using a model of the lung data, that controls for sex and a median split of the age variable (I could also control linearly for age and that would make my problem even worse). I would like to make a plot…
Simon
  • 25
  • 4
0
votes
0 answers

ggsurvplot doesn't work with coxph model or survfits

I'm trying to make a survival curve with the use of ggsurvplot. I've tried making a separate fit where the formula is invalid, putting the survfit formula directly into ggplot, and finally got a out a figure using a model as a fit, but even this…
Nate
  • 1
0
votes
1 answer

ggsurvplot in shiny: Error when p-value = TRUE

I'm trying to do a survival plot in shine, however I have a misbehavior when try to set p-value in the plot. The plot is ok when p-value is disabled. But I get an error when pval = TRUE, saying that it can't find "surv_object" function. Using local…
0
votes
1 answer

How to change the y-axis of the censoring table in ggsurvplot in R?

The ggsurvplot function from the package survminer allows users to draw Kaplen-Meier curves. It also allows us to create a table beneath the plot with the number of censored observations by configuring the ncensor.plot value. My question is: how…
Pashtun
  • 123
  • 7