Dear all,
Do you know how to return all the R settings to original state? Other than 
.Rdata and .Rhistory
 
Some weid thing happened to my machine.  I was trying to get shaded confidence 
band ploted using survplot from rms liberary.
 
It worked on one machine, but not on the other. I tried unstall R and reinstall 
R and remove. Rdata and .Rhisotory. Nothing helped so far.
 
Thanks for your input.
Best regards, 
Hong
 
Codes are
library(rms)
########data generation############
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('male','female'), n, TRUE))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- 'Year'
dd <- datadist(age, sex)
options(datadist='dd')
S <- Surv(dt,e)
tte<-data.frame(dt,e,age,sex)
############male group KM curve with bands#############
f <- survfit(Surv(dt,e)~1, data=tte,subset=sex=='male')
survplot(f,conf="bands")
############female group KM curve with bands#############
g <- survfit(Surv(dt,e)~1, data=tte,subset=sex!='male')
survplot(g,conf="bands", col=3, add=T)                                          
  
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to