[R] Incompatible methods ("-.POSIXt", "Ops.difftime") for "-"

Albrecht, Dr. Stefan (APEP) stefan.albrecht at apep.com
Mon Oct 8 12:17:39 CEST 2007


Dear all,
 
according to the Help-page of DateTimeClasses {base} I should be able to do

time - z

with

time 	date-time objects
z 	a numeric vector (in seconds) or an object of class "difftime".

However, on R version 2.6.0 (Windows XP) I get
> Sys.time() - as.difftime(c("0:3:20", "11:23:15"))
Time differences in mins
[1] 1191837998 1191837318
attr(,"tzone")
[1] ""
Warning message:
Incompatible methods ("-.POSIXt", "Ops.difftime") for "-" 


This works, on the other hand:
> Sys.time() - as.numeric(as.difftime(c("0:3:20", "11:23:15")))
[1] "2007-10-08 12:16:18 Westeuropäische Normalzeit" "2007-10-08 12:04:58 Westeuropäische Normalzeit"


Am I understanding something wrongly?


Many thanks and best regards,
Stefan

____________________________________
Dr. Stefan Albrecht, CFA
Allianz Private Equity Partners GmbH
Königinstr. 19 | 80539 Munich | Germany

Phone: +49.(0)89.3800.18317
Fax: +49.(0)89.3800.818317
EMail: stefan.albrecht at allianz.com <mailto:stefan.albrecht at allianz.com> 
Web: www.apep.com <http://www.apep.com/> 


Allianz Private Equity Partners GmbH | Geschäftsführung: Wan Ching Ang, Karl Ralf Jung
Sitz der Gesellschaft: München | Registergericht: München HRB 126221 | Ust-ID-Nr.: DE 813 264 786



More information about the R-help mailing list