For adjusted survival curves I took the sample code from here: https://rpubs.com/daspringate/survival and adapted for my date, but ... have a QUESTION.
library(survival) library(survminer) df<-read.csv("base.csv", header = TRUE, sep = ";") head(df) ID start stop censor sex age stage treatment 1 1 0 66 0 2 1 3 1 2 2 0 18 0 1 2 4 2 3 3 0 43 1 2 3 3 1 4 4 0 47 1 2 3 NA 2 5 5 0 26 0 1 4 3 NA # THANKS, DAVID WINSEMIUS for remark!!! ("R regression functions allow you to use column names.") model <- coxph( Surv(time = start, time2 = stop, event = censor) ~ treatment + age + sex + stage, data = df) plot(survfit(model), las=1, xscale = 1.00, xlab = "Months after diagnosis", ylab = "Proportion survived", main = "Baseline Hazard Curve") #HOW TO EXPLAIN TO R, THAT treatment, age, sex and stage ARE FACTORS, AND NOT CONTINUOUS VAR? treat <- with (df, data.frame ( treatment = levels(treatment), age = rep(levels(age)[1], 2), sex = rep(levels(sex)[1], 2), stage = rep(levels(stage)[1], 2))) str(treat) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.