[R] R 2.6 and library(survival)

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Nov 25 11:50:01 CET 2007


There is a reproducible example in the MASS survival chapter.  I've 
reported this to the survival maintainer more than once: it's a partial 
matching problem.

On Sat, 24 Nov 2007, Ben Bolker wrote:

>
>
>
> 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
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list