[R] survexp - example produces error

peter dalgaard pdalgd at gmail.com
Fri Dec 31 13:46:08 CET 2010


On Dec 31, 2010, at 10:21 , Heinz Tuechler wrote:

> Dear All,
> 
> reposting, because I did not find a solution, maybe someone could check the example below.
> 
> It's taken from the help page of survdiff. Executing it, gives the error
> 
> "Error in floor(temp) : Non-numeric argument to mathematical function"

Hmm, it's not happening to me (Mac OSX) either with 2.12.1 or the current R-patched (r53892). Could be a platform issue (sounds unlikely), a local user issue, or a locale one. 

Could you set options(error=recover) and find out what is the value of "temp" when the error occurs? 

> 
> best regards,
> 
> Heinz
> 
> library(survival)
> 
> ## 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)
> >
> 
> ______________________________________________
> R-help at 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list