[R] blues in c
    Peter Dalgaard BSA 
    p.dalgaard at biostat.ku.dk
       
    Tue Sep 25 15:55:37 CEST 2001
    
    
  
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> On Tue, 25 Sep 2001, Bernie McConnell wrote:
> 
> > G'Day,
> >
> > I'm a little  confused why the c function has the followng effect on
> > classes - is this a feature ?  My workround [ class(cc) <- c("POSIXt",
> > "POSIXct") ] seems to do the job.
> 
> It's a legacy
> 
> c.POSIXct <- function(..., recursive=FALSE)
>     structure(c(unlist(lapply(list(...), unclass))),
> class=c("POSIXt","POSIXct"))
> 
> does the job.
Speaking of the devil... Is there any reason as.POSIXct shouldn't work
on numeric data?
> as.POSIXct(0)
Error in as.POSIXct.default(0) : Don't know how to convert `0' to class "POSIXct"
> structure(0,class=c("POSIXt","POSIXct"))
[1] "1970-01-01 01:00:00 CET"
(Discovered by trying
c.POSIXct <- function(..., recursive=FALSE)
    as.POSIXct(c(unlist(lapply(list(...), unclass))))
)
-- 
   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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
    
    
More information about the R-help
mailing list