Skip to content

chron blues

3 messages · Bernie McConnell, Peter Dalgaard, Kurt Hornik

#
Bernie McConnell <bm8 at st-andrews.ac.uk> writes:
I don't think you're particularly naive...
The root of this seems to be this

Browse[1]> unclass(e1)+c(1.5,1.5)
[1] 3658.5 3658.5
Browse[1]> unclass(e1)+c(1.5)
[1] 3658.5
attr(,"format")
[1] "d/m/y" "h:m:s"
attr(,"origin")
month   day  year 
    1     1  1970 


This is a generic issue, recycling kills attributes:
[1] 2
attr(,"foo")
[1] "bar"
[1] 2 3

I forget whether there's a logic to this, but S-Plus 3.4 is doing the
same thing. Hence, Ops.dates inside chron probably needs fixing.
Specifically at the line

   val <- NextMethod(.Generic)

(original problem:)
..

  
    
#
Thanks for spotting this, Peter.

Bernie, could we convince you to use the date/time features added to R
1.2.0 instead?

R> as.POSIXct("1980-06-01") + rep(1.5,10)
 [1] "1980-06-01 00:00:01" "1980-06-01 00:00:01" "1980-06-01 00:00:01"
 [4] "1980-06-01 00:00:01" "1980-06-01 00:00:01" "1980-06-01 00:00:01"
 [7] "1980-06-01 00:00:01" "1980-06-01 00:00:01" "1980-06-01 00:00:01"
[10] "1980-06-01 00:00:01"

works without any problems ... (although you perhaps want to add 1.5
days rather than seconds)

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