From savicky at cs.cas.cz  Mon Mar 21 17:15:01 2011
From: savicky at cs.cas.cz (Petr Savicky)
Date: Mon, 21 Mar 2011 17:15:01 +0100
Subject: [Rd] round, unique and factor
In-Reply-To: <1300722401.29826.24.camel@nemo>
References: <1300722401.29826.24.camel@nemo>
Message-ID: <20110321161501.GA30378@cs.cas.cz>

On Mon, Mar 21, 2011 at 10:46:41AM -0500, Terry Therneau wrote:
>  Survfit had a bug in some prior releases due to the use of both
> unique(times) and table(times); I fixed it by rounding to 15 digits per
> the manual page for as.character.  Yes, I should ferret out all the
> usages instead, but this was fast and it cured the user's problem.
>   The bug is back!  A data set from a local colleage triggers it.  
> I can send the rda file to anyone who wishes.  
> 
>  The current code has
>      digits <- floor((.Machine$double.digits) * 
>                     logb(.Machine$double.base,10)) #base 10 digits
>      Y[,1] <- signif(Y[,1], digits)
> 
> which gives 15 digits; should I subtract one more?
>   
> Should the documentation change?
> 
> In the meantime I'm looking at the more permanent fix of turning time
> into a factor, then back at the very end.  Because it is a bigger change
> the potential for breakage is higer, however.

Can you describe the error in more detail? Is it related to consistency
of converting a number to character and back?

Petr Savicky.



[Rd] round, unique and factor
Petr Savicky