# misc-methods: Miscellaneous Methods for mondate's In mondate: Keep Track of Dates in Terms of Months

## Description

Miscellaneous `mondate` methods.

## Usage

 ```1 2 3 4 5 6``` ``` ## S3 method for class 'mondate' mean(x, trim = 0, na.rm = FALSE, ...) ## S3 method for class 'mondate' unique(x, ...) ## S3 method for class 'mondate' quarters(x, abbreviate) ```

## Arguments

 `x` a mondate `trim` see `base::mean` `na.rm` see `base::mean` `abbreviate` `logical`. Should the names be abbreviated? `...` arguments passed to and from other methods

## Methods

`mean(x = "mondate", ...)`

Calculate the mean date of `mondate`s. Arguments `trim` and `na.rm` have the usual meaning (see `base::mean`).

`pmean(... = "mondate")`

Calculate the "parallel" mean date of `mondate`s. Arguments in `...` must all be `mondate`s. Result will be a `mondate` with properties equal to those of the first `mondate` in `...`.

`unique(x = "mondate", ...)`

Returns a `mondate` but with duplicate elements/rows removed. For an explanation of the arguments in `...`, see `base::unique`.

`quarters(x = "mondate", abbreviate)`

Returns a `character` vector of "Q1" to "Q4". See `quarters`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```(M<-mondate.mdy(12,31,2001:2003)) mean(M) # the middle value, Dec. 31, 2002 (M<-c(M,mondate.mdy(12,31,2004))) # tack on another yearend mean(M) # mid-year 2003 mean(M,12) # 12 is coerced to Dec. 31, 2000, so the # mean is again Dec. 31, 2002 x <- mondate.ymd(2001:2005,12) # five year ends y <- x-12 # one year earlier pmean(x,y) # 2001-06-30 ... 2005-06-30 unique(M,M) # just M (M<-matrix(M,nrow=2)) # now a matrix rbind(M,M) # 2 M's, stacked unique(rbind(M,M)) # M again, still a matrix m <- mondate.ymd(2013, 1:12) # end of the months of 2013 quarters(m) ```

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