Sure, here it is:
structure(list(X = 1:26, OS = c(59, 115, 156, 421, 431, 448,
464, 475, 477, 563, 638, 744, 769, 770, 803, 855, 1040, 1106,
1129, 1206, 1227, 268, 329, 353, 365, 377), OS_event = c(1, 1,
1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 0), age = c("> 50 years", "> 50 years", "> 50 years", "> 50 years",
"> 50 years", "> 50 years", "> 50 years", "> 50 years", "> 50 years",
"> 50 years", "> 50 years", "> 50 years", "> 50 years", "< 50 years",
"< 50 years", "< 50 years", "< 50 years", "< 50 years", "< 50 years",
"< 50 years", "< 50 years", "< 50 years", "< 50 years", "< 50 years",
"< 50 years", "< 50 years"), resid.ds = c(2L, 2L, 2L, 2L, 2L,
1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L,
2L, 2L, 1L, 2L, 1L), rx = c(1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L,
2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L,
2L), ecog.ps = c(1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L,
1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L)), row.names = c(NA,
-26L), class = "data.frame")
And my code:
###### Load data and packages
pacman::p_load(pacman, party, rio, tidyverse)
library(survival) # Load survival curve package
library(survminer)
library(ggtext)
ovarian <- read.csv("~/Desktop/ovarian.csv", stringsAsFactors = FALSE)
ovarian$OS = as.numeric(ovarian$OS)
ovarian$OS_event = as.numeric(ovarian$OS_event)
# Run KM plot:
ggsurvplot(survfit(Surv(OS, OS_event) ~ ovarian$age,
data = ovarian),
risk.table = TRUE,
pval = TRUE,
pval.coord = c(72,0.8),
legend.labs = c("< 55 years", "> 55 years"),
title = " OS by binarised median age",
legend = "right",
legend.title = "Binarised
median age",
break.x.by=24,
palette = c("red", "blue"),
xlab="Time (Months)",
xlim=c(0,96))