as.duration: Change an object to a duration (difftime).
Description
as.duration changes interval, period and numeric objects
to duration objects. Numeric objects are changed to
duration objects with the seconds unit equal to the
numeric value.
Usage
as.duration(x)
Arguments
x
an interval, period, or numeric object
Value
a duration object
Details
Durations are exact time measurements, whereas periods
are relative time measurements. See
periods. The length of a period depends on
when it occurs. Hence, a one to one mapping does not
exist between durations and periods. When used with a
period object, as.duration provides an inexact estimate
of the length of the period; each time unit is assigned
its most common number of seconds. Periods with a months
unit cannot be coerced to durations because of the
variability of month lengths. For an exact
transformation, first transform the period to an interval
with as.interval.