[R] survexp - unable to reproduce example

Heinz Tuechler tuechler at gmx.at
Mon Dec 20 20:09:58 CET 2010


Dear All,

when I try to reproduce an example of survexp, taken from the help 
page of survdiff, I receive the error message
"Error in floor(temp) : Non-numeric argument to mathematical function"
.
It seems to come from match.ratetable. I think, it has to do with 
character variables in a ratetable.
I would be interested to know, if it works for others. With an older 
version of survival, it worked well.

best regards,

Heinz

library(survival)
Loading required package: splines
 > ## Example from help page of survdiff
 > ## Expected survival for heart transplant patients based on
 > ## US mortality tables
 > expect <- survexp(futime ~ ratetable(age=(accept.dt - birth.dt),
+      sex=1,year=accept.dt,race="white"), jasa, cohort=FALSE,
+      ratetable=survexp.usr)
Error in floor(temp) : Non-numeric argument to mathematical function
 > sessionInfo('survival')
R version 2.12.1 Patched (2010-12-18 r53869)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252

attached base packages:
character(0)

other attached packages:
[1] survival_2.36-2

loaded via a namespace (and not attached):
[1] base_2.12.1      graphics_2.12.1  grDevices_2.12.1 methods_2.12.1
[5] splines_2.12.1   stats_2.12.1     tools_2.12.1     utils_2.12.1
 > traceback()
2: match.ratetable(rdata, ratetable)
1: survexp(futime ~ ratetable(age = (accept.dt - birth.dt), sex = 1,
        year = accept.dt, race = "white"), jasa, cohort = FALSE,
        ratetable = survexp.usr)
 >



More information about the R-help mailing list