unit {timetools} | R Documentation |
define valid units for time objects/retrieve-set time unit of a time object
Description
The timetools package use a set of valid time units which are
roughly : year, month, week, day, hour, minute, second.
They can be combined in subtime objects
.
For instance : month of year, minute of day, minute of week, etc.
Usage
POSIXt.units(x = NULL, ...)
unit(x, ...)
unit(object) <- value
of(x, ...)
Arguments
x |
a character string representing the needed
units for |
object |
POSIXctp to which the unit is to be changed |
value |
a character or a |
... |
arguments to or from other methods |
POSIXt.units(x = NULL, ...)
With no argument, the function return a factor containing the valid time units. With an argument, it returns the units asked for.
unit(x, ...)
Return the time unit of the object. In case 'x' is a
POSIXst
, the unit is the 'left' part of
its unit : if 'x' is a 'minute of day', 'unit' will return
'minute'.
of(x, ...)
For POSIXst
only, it return the 'right' part
of the unit of 'x' : if 'x' is a 'minute of day', 'of' will return
'day'.