as.difftime: Difftime with units Months and Years

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Expand difftime units to include months and years .

Usage

1
as.difftime(tim, format = "%X", units = "auto")

Arguments

tim
format
units

Anything allowed by base:::as.difftime. In addition, can be "months" or "years" in which case tim must be numeric.

Details

Primarily used to facilitate adding months and years to mondates. See base:::as.difftime.

Value

See base:::as.difftime.

Author(s)

Dan Murphy.

See Also

Base as.difftime

Examples

1
2
3
4
x <- mondate(0:12)
y <- as.difftime(1, , "months")
x + y
x - y

Example output

Attaching package: 'mondate'

The following object is masked from 'package:base':

    as.difftime

mondate: timeunits="months"
 [1] 2000-01-31 2000-02-29 2000-03-31 2000-04-30 2000-05-31 2000-06-30
 [7] 2000-07-31 2000-08-31 2000-09-30 2000-10-31 2000-11-30 2000-12-31
[13] 2001-01-31
mondate: timeunits="months"
 [1] 1999-11-30 1999-12-31 2000-01-31 2000-02-29 2000-03-31 2000-04-30
 [7] 2000-05-31 2000-06-30 2000-07-31 2000-08-31 2000-09-30 2000-10-31
[13] 2000-11-30

mondate documentation built on Jan. 29, 2021, 5:06 p.m.

Related to as.difftime in mondate...