[Rd] Glitch involving difftime and data frame

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Tue 07 Sep 2004 - 08:17:21 EST


This looks unintentional:

> d <- as.Date("2004-09-07")
> dd <- as.Date("2004-10-04")
> data.frame(d,dd,dd-d)

Error in as.data.frame.default(x[[i]], optional = TRUE) :

        can't coerce difftime into a data.frame
> F <- data.frame(d,dd)
> F$foo <- dd-d
> cbind(F,dd-d)


Error in as.data.frame.default(x[[i]], optional = TRUE) :

        can't coerce difftime into a data.frame

Basically, the issue is that as.data.frame on a classed object expects to find a method and there isn't any for difftime...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue Sep 07 08:21:20 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:05 EST