Skip to content
Back to formatted view

Raw Message

Message-ID: <3.0.5.32.20010925142457.00956100@bute.st-and.ac.uk>
Date: 2001-09-25T13:24:57Z
From: Bernie McConnell
Subject: blues in c

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