[Rd] New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())
Gustaf Rydevik
gustaf.rydevik at gmail.com
Tue Jun 22 19:33:57 CEST 2010
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik
<gustaf.rydevik at gmail.com> wrote:
> Hi all,
>
> The recent change in 2.11 that made as.numeric() return false on
> difftime-objects broke some of my code that calculated age classes of
> individuals using cut(). While this was no big thing to fix for me, it
> might be wise
> to provide a cut.difftime method to stop other old code from breaking.
> I'm guessing something as simple as
>
> cut.difftime<-function(x,...){
> x<-as.numeric(x)
> cut(x,...)
> }
>
> would suffice.
>
> best regards,
> Gustaf
As a followup, the change in how to treat difftime objects break even
more of my old code in a different project, since I'm used to treating
difftime as numeric in regressions and other analysis.
And the error messages become *very* obscure, I.e "Error: NA/NaN/Inf
in foreign function call (arg 2)" when applying loess to a difftime
object. Tracking down the source of those errors become quite a
nuisance.
I suppose there's no chance of reversing the change, but I'd
appreciate if someone could tell me the reason for introducing it so
abrubtly.
I'm cc'ing this to R-help, since there's probably more people than me
that will be bitten by this in the future when looking into old
projects.
Regards,
Gustaf Rydevik.
--
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik
More information about the R-devel
mailing list