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
2
votes
1 answer

Risk tables in survminer not drawing ? RCPP error

I am trying to draw survival curves and associated risk tables using the survminer package. I am unable to draw the risk tables, all other elements work fine. RStudio either throws the following error: Error in bl_make_text_box(token,…
Alex Wood
  • 21
  • 2
2
votes
0 answers

Why test for trend log rank results differ with a numeric or a categorical variable in R survMisc and survminer packages?

I'm trying to make some survival analysis with an ordered categorical variable using the test for trend option in ggsurvplot function from survminer package. The p value obtained is different if my variable is numeric (1,2,3,4) or an ordered factor…
2
votes
1 answer

Survival plots with plotly

there! I try use package "plotly" to make interactive my survival curve, so for reproducible example, I use "lung" dataset: library(survival) library(survminer) library(plotly) sf_lung <- survival::survfit(survival::Surv(time, status) ~ 1, data =…
TeoK
  • 511
  • 6
  • 13
2
votes
3 answers

how can I resolve the "undefined columns selected" error for ggforest

How can I resolve the error of undefined columns selected? I have loaded the survminer and the survival packages. cox4<- coxph(formula= Surv(LOS,Mortality)~ BNPcat+HF_dx+Age+Sex+BMI+ Admit_QTc+FI02_comb+Admit_Lactate,data=DF) …
ABC
  • 21
  • 1
  • 3
2
votes
1 answer

Produce empty Plot with ggsurvplot

Is it possible to produce an empty plot with survminer::ggsurvplot? Here is an example. Say, dependent on the number of groups, I want to create a ggsurvplot. Figure 1 shows an example with 2 groups. If there are no groups, the desired outcome…
otwtm
  • 1,779
  • 1
  • 16
  • 27
2
votes
1 answer

Inserting math symbols in legends of R plots

I am using survminer to produce a survival plot with 2 survival curves, one for patients who had received 4 Packed Red Blood Cells (PRBC) units during surgery and one for patients who received more than 4 PRBC units. Unfortunately I have not been…
user156625
  • 33
  • 4
1
vote
0 answers

Get a distinct risk table for univariate and one for multivariate survival analyses

Using the code below, I have managed to create a univariate survival analysis from ggsurvplot using the survminer package. I have been able to generate a univariate analysis with cox regression and plot using ggsurvplot, but when I run my…
MaxStudent
  • 83
  • 6
1
vote
1 answer

Why am I receiving error using ggadjustedcurves for a two group, adjusted survival model: Error in if (xi > xj) 1L else -1L

I am attempting to plot adjusted survival curves for two groups (DEP+ vs DEP-), with this grouping information in the DEP_CAT variable column of the dataframe (SA.HYP.W). When trying to plot the survival of the DEP_CAT variable from the adjusted…
Jesse C
  • 11
  • 1
1
vote
0 answers

How to apply survdiff to a list of dataframes

I am trying to compare survival of all patients with a mutation in a gene to all patients without the mutation. I have a list of 66 data frames for different batches of patients in different cancer types and I want to isolate the patients with the…
1
vote
1 answer

How to calculate the events per person-years at median follow-up?

I am currently doing survival analysis for a project and wanted to calculate the event rate (Number of events / Person-time) at the median follow-up time for a study population. A snippet of my data would be: library(survival) dat1 <-…
Fabian.m
  • 55
  • 5
1
vote
1 answer

How to present survival curves with event variable with more than 2 categories in R?

I have patients who can have two types of outcomes. structure(list(time = c(45.7, 2, 98.4, 87.3, 104.5, 78.2, 78.2, 9.2, 14.2, 109.6, 39.6, 109.6, 55.8, 53.8, 6, 76.1, 118.7, 4, 2, 94.4, 41.6, 7.1, 115.7, 24.4, 97.4, 15.2, 26.4, 118.7, 69, 102.5,…
Seydou GORO
  • 1,147
  • 7
  • 13
1
vote
1 answer

How to format multiple ggsurvplots when using arrange_ggsurvplots?

I'm trying to create a figure in R which includes multiple kaplan-meier curves and label each plot (e.g. A, B, C). I've been able to make a figure using arrange_ggsurvplots, however, the output is very cramped appearing. How can I format the plots…
Ken Zhao
  • 13
  • 3
1
vote
1 answer

Stop clipping ggsurvplot risk table text while annotating right-side of survival graph (long 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,…
1
vote
1 answer

How can I write a function in R to calculate and plot a Kaplan-Meier curve depending on the independent variable?

I have a dataset my_data for survival analysis with time until a certain event of interest, status coded as 0 and 1, indicating whether the event has occurred or not at time, and several factors (factor1, factor2, ...) that might influence the…
c0rias
  • 143
  • 7
1
vote
1 answer

How to stop a Kaplan Meier curve at an earlier time point?

I have the following data which I am using to plot a Kaplan Meier curve using this code: fit <- survfit(Surv(time_to_first_g3_tox, grade_3_tox_bool) ~ tx_start_schedule, data = df) ggsurvplot(fit, risk.table = TRUE, surv.median.line = "hv") This…
Ishan Mehta
  • 326
  • 1
  • 9