Displaying 2 results from an estimated 2 matches for "edgr".
Did you mean:
edge
2017 Oct 09
0
Adjusted survival curves
...ors.
2. Jeff Newmiller: "Change the columns into factors before you give them to the coxph function, e.g. df$treatment <- as.factor(df$treatment)"
And I study David Winsemius's instructions.THANKS!!!
Code works:
library(survival)
library(survminer)
df<-read.csv("F:/R/data/edgr-orig.csv", header = TRUE, sep = ";")
head(df)
# "age" means the age groups
ID start stop censor sex age stage treatment
1 0 66 0 2 1 3 1
2 0 18 0 1 2 4 2
3 0 43 1 2 3 3 1
4 0 47 1 2 3 NA 2
5 0...
2017 Oct 09
0
Adjusted survival curves
Adjusted survival curves. (Sample code here: https://rpubs.com/daspringate/survival )
Deep gratitude?to Moderator/Admin!
At?David Winsemius prompt, more elegant working code:Thanks, Ted :)
library(survival)
library(survminer)
df<-read.csv("F:/R/data/edgr-orig.csv", header = TRUE, sep = ";")
df2 <- df
df2[,c('treatment', 'age', 'sex', 'stage')] <- lapply(df2[,c('treatment', 'age', 'sex', 'stage')], factor)
model <- coxph (Surv(time = start,
???????????????????...