| timeDateMathOps | R Documentation |
Functions for mathematical and logical operations on "timeDate"
objects.
## S4 method for signature 'timeDate,timeDate'
Ops(e1, e2)
e1, e2 |
objects of class |
Group "Ops" represents the binary mathematical operators.
Methods are defined for such operations when one or both arguments are
from class "timeDate".
Operations that don't make sense, such as addition of two
"timeDate" objects, throw error.
The plus operator "+" performs arithmetic "+" operation on
"timeDate" objects,
and the minus operator "-" returns a
difftime object if both arguments e1 and e2
are "timeDate" objects, or returns a "timeDate" object
e2 seconds earlier than e1.
addition of numeric to "timeDate" returns "timeDate",
subtraction of numeric from "timeDate" returns "timeDate",
subtraction of two "timeDate" objects returns "difftime",
other operations between two "timeDate" objects are applied to
the underlying times (slot "Date"). The result of that
operation is converted to "timeDate" if it represents a time
and returned as is otherwise.
## create some data
dts <- c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")
tms <- c( "23:12:55", "10:34:02", "08:30:00", "11:18:23")
GMT <- timeDate(dts, zone = "GMT", FinCenter = "GMT")
ZUR <- timeDate(dts, zone = "GMT", FinCenter = "Europe/Zurich")
## add one day
GMT + 24*3600
## subtract
ZUR[2] - ZUR[1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.