asDifftime | R Documentation |
To create difftime object
with additional time units 'months'
and 'years'
.
asDifftime(
tim,
units = names(timeUnits()),
negative_do = stop(sQuote(deparse1(substitute(tim))), " has negative value!"),
...
)
tim |
numeric or difftime object, similar usage as in function as.difftime |
units |
character scalar,
similar usage as in function as.difftime,
but with additional options |
negative_do |
exception handling
if input |
... |
additional parameters, currently not in use |
Function asDifftime improves function as.difftime in terms that
If input tim
is a difftime object,
function units_difftime<- is called and the unit of tim
is updated.
In function as.difftime, tim
is returned directly, i.e., parameter units
is ignored
Time units 'months'
and 'years'
are supported,
in addition to 'secs'
, 'mins'
, 'hours'
, 'days'
, 'weeks'
supported in function as.difftime.
Moreover, partial matching (via function match.arg) is allowed,
while function as.difftime requires exact matching.
End user may choose to stop if tim
has negative values.
Function as.difftime does not check for negative tim
.
Function asDifftime returns a difftime object.
Potential name clash with function as_difftime
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.