Combining-methods {mondate}R Documentation

Methods for Combining Mondates

Description

Methods to combine mondates.

Usage

 ## S3 method for class 'mondate'
rep(x, ...)
 ## S3 method for class 'mondate'
cbind(..., deparse.level = 0)
 ## S3 method for class 'mondate'
rbind(..., deparse.level = 1)
 ## S4 method for signature 'mondate'
c(x, ..., recursive = FALSE)

Arguments

x

a mondate

deparse.level

see base::cbind

recursive

see base::c

...

arguments passed to and from other methods

Details

The package calls setGeneric("c-rbind").

Value

A mondate. For cbind and rbind, a matrix. For c and rep, a vector.

Methods

c(x = "mondate", ...)

Combine mondates into a vector. ... any R object(s) that can be coerced to a mondate. The behavior mimics that of the base function. The result will be a mondate with properties equal to those of x.

c-rbind(... = "mondate")

The cbind and rbind methods use the base cbind and rbind functions, respectively, to combine the arguments and the result is converted to a mondate with displayFormat and timeunits properties equal to those of the first argument in ....

rep(x = "mondate", ...)

Replicates a mondate. The behavior mimics that of the base function. See rep for further details. The result will be a mondate with properties equal to those of x.

Examples

x <- mondate(1:6) # first 6 month-ends of the year 2000
c(x,x+6)          # all month-ends of 2000
c(0,x)            # result is "numeric", as determined by the first argument

M<-mondate.ymd(2001:2005,12,31) # 5 year-ends
names(M)<-LETTERS[1:5]
cbind(M)                      # as a 5x1 matrix
rbind(M,M)
begin_date <- M-12
cbind(begin_date,end_date=M)  # 5 pairs of year boundary-dates. Columns are
                              # "automatically" named in the default case 
                              # (all mondates with timeunits="months").
dayt <- as.Date("2010-6-30")
cbind(x,mondate(dayt))        # column names show as 'x' and blank
cbind(x=x,DateColumn=mondate("2010-6-30")) # both columns are named

rep(mondate("2010-2-14"), 3)

(M<-seq(from=mondate("1/1/2010"),length=2)) # Jan. and Feb. 1st
rep(M,3)                                    # three pairs
rep(M,each=3)                               # three Jan.'s, three Feb.'s

[Package mondate version 0.9.9.01 Index]