[Rd] New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())

From: Gustaf Rydevik <gustaf.rydevik_at_gmail.com>
Date: Tue, 22 Jun 2010 19:33:57 +0200


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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 22 Jun 2010 - 17:36:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jun 2010 - 19:01:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive