Learn R Programming

mondate (version 0.9.10.01)

Arith-methods: Methods for Function Group Arith

Description

Arithmetic methods for class mondate. Includes three special "subtraction" methods.

Arguments

See Also

Arith

Examples

Run this code
M <- mondate("1-1-2010") # will display in U.S. date format
M - 1:12 # the 1st of the month for all months in 2009
       # in reverse chronological order; inherits M's displayFormat

x <- mondate(matrix(12 * 1:4, 2, 2)) # 2x2 matrix of 2000-2003 year ends
x                                
y <- x + 12                          # one year later, also a matrix
y
y - x                      # 2x2 matrix of 12s, with an attribute ("months")
MonthsBetween(x, y)        # same, without the attribute
YearsBetween(x, y)
DaysBetween(x, y)

Run the code above in your browser using DataLab