nanoduration-class | R Documentation |
The type nanoduration
is a length of time (implemented as
an S4 class) with nanosecond precision. It is a count of
nanoseconds and may be negative. The expected arithmetic
operations are provided, including sequence generation.
nanoduration(hours = 0L, minutes = 0L, seconds = 0L, nanoseconds = 0L) ## S4 method for signature 'character' as.nanoduration(x) ## S4 method for signature 'integer64' as.nanoduration(x) ## S4 method for signature 'numeric' as.nanoduration(x) ## S4 method for signature 'integer' as.nanoduration(x) ## S4 method for signature 'difftime' as.nanoduration(x) ## S4 method for signature ''NULL'' as.nanoduration(x) ## S4 method for signature 'missing' as.nanoduration(x) ## S4 method for signature 'nanoduration' show(object) ## S4 method for signature 'nanoduration' print(x, quote = FALSE, ...) ## S3 method for class 'nanoduration' format(x, ...) ## S3 method for class 'nanoduration' as.integer64(x, ...) ## S4 method for signature 'nanoduration' as.character(x) ## S4 method for signature 'nanoduration' is.na(x) ## S4 method for signature 'nanoduration,nanoduration' e1 - e2 ## S4 method for signature 'nanoduration,integer64' e1 - e2 ## S4 method for signature 'nanoduration,integer' e1 - e2 ## S4 method for signature 'nanoduration,numeric' e1 - e2 ## S4 method for signature 'nanoduration,difftime' e1 - e2 ## S4 method for signature 'nanoduration,ANY' e1 - e2 ## S4 method for signature 'nanotime,nanoduration' e1 - e2 ## S4 method for signature 'nanotime,difftime' e1 - e2 ## S4 method for signature 'integer64,nanoduration' e1 - e2 ## S4 method for signature 'integer,nanoduration' e1 - e2 ## S4 method for signature 'numeric,nanoduration' e1 - e2 ## S4 method for signature 'difftime,nanoduration' e1 - e2 ## S4 method for signature 'ANY,nanoduration' e1 - e2 ## S4 method for signature 'nanoduration,ANY' e1 + e2 ## S4 method for signature 'nanoduration,nanoduration' e1 + e2 ## S4 method for signature 'nanoduration,integer64' e1 + e2 ## S4 method for signature 'nanoduration,numeric' e1 + e2 ## S4 method for signature 'nanoduration,difftime' e1 + e2 ## S4 method for signature 'nanotime,nanoduration' e1 + e2 ## S4 method for signature 'nanotime,difftime' e1 + e2 ## S4 method for signature 'nanoduration,nanotime' e1 + e2 ## S4 method for signature 'difftime,nanotime' e1 + e2 ## S4 method for signature 'nanoival,nanoduration' e1 + e2 ## S4 method for signature 'nanoival,nanoduration' e1 - e2 ## S4 method for signature 'nanoduration,nanoival' e1 + e2 ## S4 method for signature 'nanoival,difftime' e1 + e2 ## S4 method for signature 'nanoival,difftime' e1 - e2 ## S4 method for signature 'difftime,nanoival' e1 + e2 ## S4 method for signature 'integer64,nanoduration' e1 + e2 ## S4 method for signature 'numeric,nanoduration' e1 + e2 ## S4 method for signature 'difftime,nanoduration' e1 + e2 ## S4 method for signature 'nanoduration,numeric' e1 * e2 ## S4 method for signature 'nanoduration,integer64' e1 * e2 ## S4 method for signature 'numeric,nanoduration' e1 * e2 ## S4 method for signature 'integer64,nanoduration' e1 * e2 ## S4 method for signature 'nanoduration,nanoduration' e1 / e2 ## S4 method for signature 'nanoduration,integer64' e1 / e2 ## S4 method for signature 'nanoduration,numeric' e1 / e2 ## S4 method for signature 'nanoduration,ANY' Arith(e1, e2) ## S4 method for signature 'nanoduration,character' Compare(e1, e2) ## S4 method for signature 'character,nanoduration' Compare(e1, e2) ## S4 method for signature 'nanoduration,ANY' Compare(e1, e2) ## S4 method for signature 'nanoduration' abs(x) ## S4 method for signature 'nanoduration' sign(x) ## S4 method for signature 'nanoduration' sum(x, ..., na.rm = FALSE) ## S4 method for signature 'nanoduration' min(x, ..., na.rm = FALSE) ## S4 method for signature 'nanoduration' max(x, ..., na.rm = FALSE) ## S4 method for signature 'nanoduration' range(x, ..., na.rm = FALSE) ## S4 method for signature 'nanoduration' x[[i, j, ..., drop = FALSE]] ## S4 method for signature 'nanoduration,numeric' x[i, j, ..., drop = FALSE] ## S4 method for signature 'nanoduration,logical' x[i, j, ..., drop = FALSE] ## S4 method for signature 'nanoduration,character' x[i, j, ..., drop = FALSE] ## S4 method for signature 'nanoduration,ANY' x[i, j, ..., drop = FALSE] ## S4 replacement method for signature 'nanoduration,ANY,ANY,ANY' x[i, j, ...] <- value ## S3 method for class 'nanoduration' c(...) NA_nanoduration_
hours |
number of hours |
minutes |
number of minutes |
seconds |
number of seconds |
nanoseconds |
number of nanoseconds |
x |
a |
object |
argument for method |
quote |
indicates if the output of |
... |
further arguments passed to or from methods. |
e1 |
Operand of class |
e2 |
Operand of class |
na.rm |
if |
i |
index specifying elements to extract or replace. |
j |
Required for |
drop |
Required for |
value |
argument for |
An object of class nanoduration
of length 1.
A nanoduration
can be constructed with the function
as.nanoduration
which can take the types integer64
,
integer
and numeric
(all indicating the count in
nanosecond units) or the type character
.
It can also be constructed by specifying with individual arguments
the hours, minutes, seconds and nanoseconds with a call to
nanoduration
.
A nanoduration
is displayed as hours, minutes, seconds and
nanoseconds like this: 110:12:34.123_453_001
. The nanosecond
precision displayed is adjusted as necessary, so e.g. 1 second is
displayed as 00:00:01
.
A nanoduration object
Dirk Eddelbuettel
Leonardo Silvestri
nanotime
## constructors: nanoduration(hours=10, minutes=3, seconds=2, nanoseconds=999999999) as.nanoduration("10:03:02.999_999_999") as.nanoduration(36182999999999) ## arithmetic: as.nanoduration(10e9) - as.nanoduration(9e9) as.nanoduration(10e9) + as.nanoduration(-9e9) as.nanoduration("24:00:00") / 2 as.nanoduration("24:00:00") / as.nanoduration("12:00:00") ## comparison: as.nanoduration("10:03:02.999_999_999") == 36182999999999 as.nanoduration("10:03:02.999_999_999") > as.nanoduration("10:03:02.999_999_998") as.nanoduration("10:03:02.999_999_998") < "10:03:02.999_999_999"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.