units_difftime<- | R Documentation |
Set units of difftime objects,
with additional support of 'months'
and 'years'
.
units_difftime(x) <- value
x |
difftime object |
value |
character scalar, choice of unit |
Function units_difftime<- supports 'months'
and 'years'
in addition to 'secs'
, 'mins'
, 'hours'
, 'days'
, 'weeks'
supported in function units<-.difftime.
Function units_difftime<- returns a difftime object.
(x = Sys.Date() - as.Date('2021-01-01'))
tryCatch(units(x) <- 'months', error = identity)
units_difftime(x) <- 'months'; x
units_difftime(x) <- 'years'; x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.