[Rd] Glitch involving difftime and data frame

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Sep 7 00:17:21 CEST 2004


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 at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list