[R] R 2.6 and library(survival)

Ben Bolker bolker at ufl.edu
Sun Nov 25 04:52:45 CET 2007

makis motakis-2 wrote:
> Hi all,
> I have installed in R 2.6 the survival package and I am trying to analyze
> some 
> data and present plots. The problem occurs when I try to plot lines on 
> the same plot. E.g. take simulated data for time (t), event (e) and groups 
> (group1 and group2) and do:
> ### this is how I create the plots
> plot1<-survfit(Surv(t,e)~ as.factor(group1))
> plot2<-survfit(Surv(t,e)~ as.factor(group2))
> plot(plot1)
> lines(plot2,type="s")
>    Error in rep(2, n2 - 1) : invalid 'times' argument
> The plot is created (plot1) but the lines (plot2) are not. I have run this
> same program 
> several times from my previous pc (R 2.4 was installed)and I never had
> such a problem. 
> Now suddenly this error message appears and it concerns only the survival
> package (I mean 
> for simple plots there is no problem to plot lines in an existing plot).
> Is there a problem 
> with R 2.6 on this matter? Can someone please help?

Don't know ... a simple reproducible example would help ...

(Some really really trivial things I tried worked, for example:

z = rexp(100)
f1 = factor(rep(1:5,each=20))
f2 = factor(rep(1:2,each=50))
event = rep(1,100)
s1 = survfit(Surv(z,event)~f1)
s2 = survfit(Surv(z,event)~f2)

> sessionInfo()
R version 2.6.0 (2007-10-03) 


attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] survival_2.34

  Ben Bolker

View this message in context: http://www.nabble.com/R-2.6-and-library%28survival%29-tf4859847.html#a13932498
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list