c-methods: Methods for Combining Mondates

Combining-methodsR Documentation

Methods for Combining Mondates

Description

Methods to combine mondates.

Usage

 cbindmondate(..., deparse.level = 1)
 rbindmondate(..., deparse.level = 1)
 ## S3 method for class 'mondate'
rep(x, ...)
 ## 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

c-rbindmondate(...)

The cbindmondate and rbindmondate functions are similar to the base cbind and rbind functions, respectively, to combine the arguments. If all arguments are mondates then the result is converted to a mondate with displayFormat and timeunits properties equal to those of the first argument in .... If not all arguments are mondates then the result is a data.frame by virtue of the call cbind.data.frame(...).

A mondate (or a data.frame from c-rbindmondate when ... holds non-mondate arguments). 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.

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]
cbindmondate(M)                      # as a 5x1 matrix
rbindmondate(M,M)
begin_date <- M-12
cbindmondate(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")
cbindmondate(x,mondate(dayt))        # column names show as 'x' and blank
cbindmondate(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

mondate documentation built on May 29, 2024, 1:32 a.m.

Related to c-methods in mondate...