[R] blues in c

Bernie McConnell bm8 at st-andrews.ac.uk
Tue Sep 25 15:24:57 CEST 2001


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.

Many thanks

Bernie McConnell


"R version 1.3.1, 2001-08-31" on NT

> aa <- as.POSIXct("2001-09-23")
> bb <- as.POSIXct("2001-09-24")
> cc <- c(aa,bb)
> aa - bb
Time difference of -1 days
> aa - cc[2]
[1] "1969-12-31 GMT Standard Time"
Warning message: 
Incompatible methods ("-.POSIXt", "-.POSIXct") for "-" 
> 
> class(aa)
[1] "POSIXt"  "POSIXct"
> class(cc)
[1] "POSIXct"
> 
> class(cc) <- c("POSIXt", "POSIXct")
> aa - cc[2]
Time difference of -1 days

Bernie McConnell
NERC SEA MAMMAL RESEARCH UNIT
Gatty Marine Lab, St Andrews University
St Andrews, Fife,  KY16 8LB, Scotland.

b.mcconnell at smru.st-andrews.ac.uk
http://www.smru.st-and.ac.uk
tel:  	+44 (1334) 463280   
fax:  	+44 (1334) 462632   


                
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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