[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)
library(survival)
s1 = survfit(Surv(z,event)~f1)
s2 = survfit(Surv(z,event)~f2)
plot(s1)
lines(s2,col=2,type="s")

> sessionInfo()
R version 2.6.0 (2007-10-03) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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