as_years_durationy: Convert a 'durationy' to duration in years

as_years_durationyR Documentation

Convert a durationy to duration in years

Description

Converts a durationy to its duration measured in years.

as.numeric() is the same as as.double().

as.integer() obtains the integer part as an integer, e.g. as.integer(durationy(1.75)) is 1 and as.integer(durationy(-1.75)) is -1 (i.e. rounding towards 0). It is also the case that if x is a durationy then as.integer(x) is the same as as.integer(as.double(x)).

Usage

## S3 method for class 'durationy'
as.double(x, ...)

## S3 method for class 'durationy'
as.integer(x, ...)

Arguments

x

The durationy to convert to years.

...

Not used.

Value

A vector of double.

See Also

durationy, as_years_datey, ops

Examples

d <- durationy(1.75)
d                   # 1.75 yr
as.double(d)        # 1.75
as.numeric(d)       # 1.75
as.integer(d)       # 1
as.integer(-d)      # -1
identical(as.integer(d), 1L) # TRUE

datey documentation built on July 14, 2026, 5:06 p.m.