Albrecht, Dr. Stefan (APEP)
2007-Oct-08 10:17 UTC
[R] Incompatible methods ("-.POSIXt", "Ops.difftime") for "-"
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
Prof Brian Ripley
2007-Oct-08 16:21 UTC
[R] Incompatible methods ("-.POSIXt", "Ops.difftime") for "-"
On Mon, 8 Oct 2007, Albrecht, Dr. Stefan (APEP) wrote:> 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?No, that currently does not work (it did when the page was written). This does Sys.time() - unclass(as.difftime(c("0:3:20", "11:23:15"))) -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hi all, (Apologies if this has been asked before; I tried to search for it in the archives, but searching for terms like 'N' yields too many hits) Is it possible to display symbols like 'R' (the set of real numbers, so with an additional vertical line on the left) in plots using expression/plotmath? Thanks, Casper